javax.servlet.sip
Interface SipURI

All Superinterfaces:
Cloneable, URI

public interface SipURI
extends URI

Represents sip and sips URIs. SIP and SIPS URIs are used for addressing. They are similar to email addresses in that they are of the form user@host where user is either a user name or telephone number, and host is a host or domain name, or a numeric IP address. Additionally, SIP and SIPS URIs may contain parameters and headers (although headers are not legal in all contexts). Syntactically, SIP and SIPS URIs are identical except for the name of URI scheme. The semantics differs in that the SIPS scheme implies that the identified resource is to be contacted using TLS. The following quote is from RFC 3261: Because sip and sips URIs are syntactically identical and because they're used the same way, they're both represented by the SipURI interface. The string form of SIP and SIPS URIs may contain escaped characters. The SIP servlet container is responsible for unescaping those characters before presenting URIs to servlets. Likewise, string values passed to setters for various SIP(S) URI components may contain reserved or excluded characters that need escaping before being used. The container is responsible for escaping those values. See Also:Address, SipFactory.createSipURI(java.lang.String, java.lang.String), SipServletRequest.getRequestURI()


Method Summary
 boolean equals(Object o)
          Compares the given SipURI with this SipURI.
 String getHeader(String name)
          Returns the value of the specified header.
 Iterator<String> getHeaderNames()
          Returns an Iterator over the names of all headers present in this SipURI.
 String getHost()
          Returns the host part of this SipURI.
 boolean getLrParam()
          Returns true if the "lr" flag parameter is set, and false otherwise.
 String getMAddrParam()
          Returns the value of the "maddr" parameter, or null if this is not set.
 String getMethodParam()
          Returns the value of the "method" parameter, or null if this is not set.
 int getPort()
          Returns the port number of this SipURI, or -1 if this is not set.
 String getTransportParam()
          Returns the value of the "transport" parameter, or null if this is not set.
 int getTTLParam()
          Returns the value of the "ttl" parameter, or -1 if this is not set.
 String getUser()
          Returns the user part of this SipURI.
 String getUserParam()
          Returns the value of the "user" parameter, or null if this is not set.
 String getUserPassword()
          Returns the password of this SipURI, or null if this is not set.
 boolean isSecure()
          Returns true if this SipURI is secure, that is, if this it represents a sips URI.
 void removeHeader(String name)
          Removes the value of the specified header in this SipURI.
 void setHeader(String name, String value)
          Sets the value of the specified header in this SipURI.
 void setHost(String host)
          Sets the host part of this SipURI.
 void setLrParam(boolean flag)
          Sets or removes the "lr" parameter depending on the value of the flag.
 void setMAddrParam(String maddr)
          Sets the value of the "maddr" parameter.
 void setMethodParam(String method)
          Sets the value of the "method" parameter.
 void setPort(int port)
          Sets the port number of this SipURI.
 void setSecure(boolean b)
          Sets the scheme of this URI to sip or sips depending on whether the argument is true or not.
 void setTransportParam(String transport)
          Sets the value of the "transport" parameter.
 void setTTLParam(int ttl)
          Sets the value of the "ttl" parameter.
 void setUser(String user)
          Sets the user part of this SipURI.
 void setUserParam(String user)
          Sets the value of the "user" parameter.
 void setUserPassword(String password)
          Sets the password of this SipURI.
 String toString()
          Returns the String representation of this SipURI.
 
Methods inherited from interface javax.servlet.sip.URI
clone, getParameter, getParameterNames, getScheme, isSipURI, removeParameter, setParameter
 

Method Detail

equals

boolean equals(Object o)
Compares the given SipURI with this SipURI. The rules specified in section 19.1.4 RFC 3261 must be used for comparison.

Specified by:
equals in interface URI
Overrides:
equals in class Object

getHeader

String getHeader(String name)
Returns the value of the specified header. SIP/SIPS URIs may specify headers. As an example, the URI sip:joe@example.com?Priority=emergency has a header "Priority" whose value is "emergency".


getHeaderNames

Iterator<String> getHeaderNames()
Returns an Iterator over the names of all headers present in this SipURI.


getHost

String getHost()
Returns the host part of this SipURI.


getLrParam

boolean getLrParam()
Returns true if the "lr" flag parameter is set, and false otherwise. This is equivalent to "".equals(getParameter("lr")).


getMAddrParam

String getMAddrParam()
Returns the value of the "maddr" parameter, or null if this is not set. This is equivalent to getParameter("maddr").


getMethodParam

String getMethodParam()
Returns the value of the "method" parameter, or null if this is not set. This is equivalent to getParameter("method").


getPort

int getPort()
Returns the port number of this SipURI, or -1 if this is not set.


getTransportParam

String getTransportParam()
Returns the value of the "transport" parameter, or null if this is not set. This is equivalent to getParameter("transport").


getTTLParam

int getTTLParam()
Returns the value of the "ttl" parameter, or -1 if this is not set. This method is equivalent to getParameter("ttl").


getUser

String getUser()
Returns the user part of this SipURI.


getUserParam

String getUserParam()
Returns the value of the "user" parameter, or null if this is not set. This is equivalent to getParameter("user").


getUserPassword

String getUserPassword()
Returns the password of this SipURI, or null if this is not set.


isSecure

boolean isSecure()
Returns true if this SipURI is secure, that is, if this it represents a sips URI. For "ordinary" sip URIs, false is returned.


removeHeader

void removeHeader(String name)
Removes the value of the specified header in this SipURI.

Parameters:
name - header name

setHeader

void setHeader(String name,
               String value)
Sets the value of the specified header in this SipURI.


setHost

void setHost(String host)
Sets the host part of this SipURI. This should be a fully qualified domain name or a numeric IP address.


setLrParam

void setLrParam(boolean flag)
Sets or removes the "lr" parameter depending on the value of the flag.


setMAddrParam

void setMAddrParam(String maddr)
Sets the value of the "maddr" parameter. This is equivalent to setParameter("maddr", maddr).


setMethodParam

void setMethodParam(String method)
Sets the value of the "method" parameter. This specifies which SIP method to use in requests directed at this SIP/SIPS URI. This method is equivalent to setParameter("method", method).


setPort

void setPort(int port)
Sets the port number of this SipURI.


setSecure

void setSecure(boolean b)
Sets the scheme of this URI to sip or sips depending on whether the argument is true or not.


setTransportParam

void setTransportParam(String transport)
Sets the value of the "transport" parameter. This parameter specifies which transport protocol to use for sending requests and responses to this entity. The following values are defined: "udp", "tcp", "sctp", "tls", but other values may be used also This method is equivalent to setParameter("transport", transport).


setTTLParam

void setTTLParam(int ttl)
Sets the value of the "ttl" parameter. The ttl parameter specifies the time-to-live value when packets are sent using UDP multicast. This is equivalent to setParameter("ttl", ttl).


setUser

void setUser(String user)
Sets the user part of this SipURI.


setUserParam

void setUserParam(String user)
Sets the value of the "user" parameter. This is equivalent to setParameter("user", user).


setUserPassword

void setUserPassword(String password)
Sets the password of this SipURI. The use of passwords in SIP or SIPS URIs is discouraged as sending passwords in clear text is a security risk.


toString

String toString()
Returns the String representation of this SipURI. Any reserved characters will be properly escaped according to RFC2396.

Specified by:
toString in interface URI
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.