本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例7: parseURI
import javax.sip.address.URI; //导入方法依赖的package包/类
public static String parseURI(HeaderAddress header) {
URI uri = getURI(header);
return uri != null ? uri.toString() : null;
}