当前位置: 首页>>代码示例>>Java>>正文


Java URI.toString方法代码示例

本文整理汇总了Java中javax.sip.address.URI.toString方法的典型用法代码示例。如果您正苦于以下问题:Java URI.toString方法的具体用法?Java URI.toString怎么用?Java URI.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sip.address.URI的用法示例。


在下文中一共展示了URI.toString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doAuthenticateHashedPassword

import javax.sip.address.URI; //导入方法依赖的package包/类
/**
 * Authenticate the inbound request.
 *
 * @param request - the request to authenticate.
 * @param hashedPassword -- the MD5 hashed string of username:realm:plaintext password.
 * 
 * @return true if authentication succeded and false otherwise.
 */
public boolean doAuthenticateHashedPassword(Request request, String hashedPassword) {
    ProxyAuthorizationHeader authHeader = (ProxyAuthorizationHeader) request.getHeader(ProxyAuthorizationHeader.NAME);
    if ( authHeader == null ) return false;
    String realm = authHeader.getRealm();
    String username = authHeader.getUsername();
  
    if ( username == null || realm == null ) {
        return false;
    }
   
    String nonce = authHeader.getNonce();
    URI uri = authHeader.getURI();
    if (uri == null) {
        return false;
    }
    

  
    String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
    String HA1 = hashedPassword;

   
    byte[] mdbytes = messageDigest.digest(A2.getBytes());
    String HA2 = toHexString(mdbytes);
  
    String KD = HA1 + ":" + nonce;

    KD += ":" + HA2;
    mdbytes = messageDigest.digest(KD.getBytes());
    String mdString = toHexString(mdbytes);
    String response = authHeader.getResponse();
   

    return mdString.equals(response);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:44,代码来源:DigestServerAuthenticationHelper.java

示例2: getDisplayName

import javax.sip.address.URI; //导入方法依赖的package包/类
/**
 * Returns a human readable name representing this peer.
 *
 * @return a String containing a name for that peer.
 */
public String getDisplayName()
{
    String displayName = getPeerAddress().getDisplayName();

    if(displayName == null)
    {
        Contact contact = getContact();

        if (contact != null)
            displayName = contact.getDisplayName();
        else
        {
            URI peerURI = getPeerAddress().getURI();

            if (peerURI instanceof SipURI)
            {
                String userName = ((SipURI) peerURI).getUser();

                if (userName != null && userName.length() > 0)
                    displayName = userName;
            }
            else
            {
                displayName = peerURI.toString();
            }
        }
    }

    if(displayName.startsWith("sip:"))
        displayName = displayName.substring(4);

    return displayName;
}
 
开发者ID:zhaozw,项目名称:android-1,代码行数:39,代码来源:CallPeerSipImpl.java

示例3: getDisplayName

import javax.sip.address.URI; //导入方法依赖的package包/类
/**
 * Returns a human readable name representing this peer.
 *
 * @return a String containing a name for that peer.
 */
public String getDisplayName()
{
    String displayName = getPeerAddress().getDisplayName();

    if(displayName == null)
    {
        Contact contact = getContact();

        if (contact != null)
            displayName = contact.getDisplayName();
        else
        {
            URI peerURI = getPeerAddress().getURI();
            if (peerURI instanceof SipURI)
            {
                String userName = ((SipURI) peerURI).getUser();

                if (userName != null && userName.length() > 0)
                    displayName = userName;
            }

            if (displayName == null)
            {
                displayName = peerURI.toString();
            }
        }
    }

    if(displayName.startsWith("sip:"))
        displayName = displayName.substring(4);

    return displayName;
}
 
开发者ID:jitsi,项目名称:jitsi,代码行数:39,代码来源:CallPeerSipImpl.java

示例4: doAuthenticatePlainTextPassword

import javax.sip.address.URI; //导入方法依赖的package包/类
/**
 * Authenticate the inbound request given plain text password.
 *
 * @param request - the request to authenticate.
 * @param pass -- the plain text password.
 * 
 * @return true if authentication succeded and false otherwise.
 */
public boolean doAuthenticatePlainTextPassword(Request request, String pass) {
    ProxyAuthorizationHeader authHeader = (ProxyAuthorizationHeader) request.getHeader(ProxyAuthorizationHeader.NAME);
   
    if ( authHeader == null ) return false;
    String realm = authHeader.getRealm();
    String username = authHeader.getUsername();
  
   
    if ( username == null || realm == null ) {
        return false;
    }
    

    String nonce = authHeader.getNonce();
    URI uri = authHeader.getURI();
    if (uri == null) {
       return false;
    }
    

    String A1 = username + ":" + realm + ":" + pass;
    String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
    byte mdbytes[] = messageDigest.digest(A1.getBytes());
    String HA1 = toHexString(mdbytes);

   
    mdbytes = messageDigest.digest(A2.getBytes());
    String HA2 = toHexString(mdbytes);
  
    String cnonce = authHeader.getCNonce();
    String KD = HA1 + ":" + nonce;
    if (cnonce != null) {
        KD += ":" + cnonce;
    }
    KD += ":" + HA2;
    mdbytes = messageDigest.digest(KD.getBytes());
    String mdString = toHexString(mdbytes);
    String response = authHeader.getResponse();
    return mdString.equals(response);
    
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:50,代码来源:DigestServerAuthenticationHelper.java

示例5: doAuthenticateHashedPassword

import javax.sip.address.URI; //导入方法依赖的package包/类
/**
 * Authenticate the inbound request.
 *
 * @param request - the request to authenticate.
 * @param hashedPassword -- the MD5 hashed string of username:realm:plaintext password.
 *
 * @return true if authentication succeded and false otherwise.
 */
public boolean doAuthenticateHashedPassword(Request request, String hashedPassword) {
    AuthorizationList authHeaderList = (AuthorizationList) request.getHeader("AuthorizationList");
    if ( authHeaderList == null ) return false;
    Authorization authHeader = authHeaderList.get(0);
    if ( authHeader == null ) return false;
    String realm = authHeader.getRealm();
    String username = authHeader.getName();

    if ( username == null || realm == null ) {
        return false;
    }

    String nonce = authHeader.getNonce();
    URI uri = authHeader.getURI();
    if (uri == null) {
        return false;
    }



    String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
    String HA1 = hashedPassword;


    byte[] mdbytes = messageDigest.digest(A2.getBytes());
    String HA2 = toHexString(mdbytes);

    String cnonce = authHeader.getNonce();
    String KD = HA1 + ":" + nonce;
    if (cnonce != null) {
        KD += ":" + cnonce;
    }
    KD += ":" + HA2;
    mdbytes = messageDigest.digest(KD.getBytes());
    String mdString = toHexString(mdbytes);
    String response = authHeader.getResponse();


    return mdString.equals(response);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:49,代码来源:DigestServerAuthenticationWWWHelper.java

示例6: doAuthenticatePlainTextPassword

import javax.sip.address.URI; //导入方法依赖的package包/类
/**
 * Authenticate the inbound request given plain text password.
 *
 * @param request - the request to authenticate.
 * @param pass -- the plain text password.
 *
 * @return true if authentication succeded and false otherwise.
 */
public boolean doAuthenticatePlainTextPassword(Request request, String pass) {
    Authorization authHeader = (Authorization) request.getHeader(Authorization.NAME);
    if ( authHeader == null ) return false;
    String realm = authHeader.getRealm();
    String username = authHeader.getName();


    if ( username == null || realm == null ) {
        return false;
    }


    String nonce = authHeader.getNonce();
    URI uri = authHeader.getURI();
    if (uri == null) {
        return false;
    }


    String A1 = username + ":" + realm + ":" + pass;
    String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
    byte mdbytes[] = messageDigest.digest(A1.getBytes());
    String HA1 = toHexString(mdbytes);


    mdbytes = messageDigest.digest(A2.getBytes());
    String HA2 = toHexString(mdbytes);

    String cnonce = authHeader.getNonce();
    String KD = HA1 + ":" + nonce;
    if (cnonce != null) {
        KD += ":" + cnonce;
    }
    KD += ":" + HA2;
    mdbytes = messageDigest.digest(KD.getBytes());
    String mdString = toHexString(mdbytes);
    String response = authHeader.getResponse();
    return mdString.equals(response);

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:49,代码来源:DigestServerAuthenticationWWWHelper.java

示例7: parseURI

import javax.sip.address.URI; //导入方法依赖的package包/类
public static String parseURI(HeaderAddress header) {
    URI uri = getURI(header);
    return uri != null ? uri.toString() : null;
}
 
开发者ID:sip3io,项目名称:tapir,代码行数:5,代码来源:HeaderAddressUtil.java


注:本文中的javax.sip.address.URI.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。