|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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:
"A SIPS URI specifies that the resource be contacted securely. This means, in particular, that TLS is to be used between the UAC and the domain that owns the URI. From there, secure communications are used to reach the user, where the specific security mechanism depends on the policy of the domain. Any resource described by a SIP URI can be "upgraded" to a SIPS URI by just changing the scheme, if it is desired to communicate with that resource securely."
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.
Address
,
SipFactory.createSipURI(java.lang.String, java.lang.String)
,
SipServletRequest.getRequestURI()
Method Summary | |
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specified header. |
java.util.Iterator |
getHeaderNames()
Returns an Iterator over the names of all headers
present in this SipURI . |
java.lang.String |
getHost()
Returns the host part of this SipURI . |
boolean |
getLrParam()
Returns true if the "lr" flag parameter is set, and false otherwise. |
java.lang.String |
getMAddrParam()
Returns the value of the "maddr" parameter, or null if this is not set. |
java.lang.String |
getMethodParam()
Returns the value of the "method" parameter, or null if this is not set. |
java.lang.String |
getParameter(java.lang.String name)
Returns the value of the named parameter, or null if it is not set. |
java.util.Iterator |
getParameterNames()
Returns an Iterator over the names (Strings )
of all parameters present in this SipURI . |
int |
getPort()
Returns the port number of this SipURI ,
or -1 if this is not set. |
java.lang.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. |
java.lang.String |
getUser()
Returns the user part of this SipURI . |
java.lang.String |
getUserParam()
Returns the value of the "user" parameter, or null if this is not set. |
java.lang.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 |
removeParameter(java.lang.String name)
Removes the specified parameter. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets the value of the specified header in this SipURI . |
void |
setHost(java.lang.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(java.lang.String maddr)
Sets the value of the "maddr" parameter. |
void |
setMethodParam(java.lang.String method)
Sets the value of the "method" parameter. |
void |
setParameter(java.lang.String name,
java.lang.String value)
Sets the value of the specified 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(java.lang.String transport)
Sets the value of the "transport" parameter. |
void |
setTTLParam(int ttl)
Sets the value of the "ttl" parameter. |
void |
setUser(java.lang.String user)
Sets the user part of this SipURI . |
void |
setUserParam(java.lang.String user)
Sets the value of the "user" parameter. |
void |
setUserPassword(java.lang.String password)
Sets the password of this SipURI . |
java.lang.String |
toString()
Returns the String representation of this
SipURI . |
Methods inherited from interface javax.servlet.sip.URI |
clone, getScheme, isSipURI |
Method Detail |
public java.lang.String getUser()
SipURI
.SipURI
public void setUser(java.lang.String user)
SipURI
.user
- the new user partpublic java.lang.String getUserPassword()
SipURI
,
or null if this is not set.SipURI
public void setUserPassword(java.lang.String password)
SipURI
. The use of passwords
in SIP or SIPS URIs is discouraged as sending passwords in clear text
is a security risk.password
- the new passwordpublic java.lang.String getHost()
SipURI
.SipURI
public void setHost(java.lang.String host)
SipURI
. This should be a fully
qualified domain name or a numeric IP address.host
- the new host namepublic int getPort()
SipURI
,
or -1 if this is not set.SipURI
public void setPort(int port)
SipURI
.port
- the new port number. A negative value means the
port number is not set and a subsequent call to
getPort() should return -1.public boolean isSecure()
SipURI
is secure, that is,
if this it represents a sips
URI. For "ordinary"
sip
URIs, false is returned.SipURI
represents a sips
URI, and false if it represents a sip
URIpublic void setSecure(boolean b)
sip
or sips
depending on whether the argument is true or not.b
- determines whether the scheme of this SipURI
is set to sip
or sips
public java.lang.String getParameter(java.lang.String name)
name
- a String
specifying the parameter namepublic void setParameter(java.lang.String name, java.lang.String value)
name
- parameter namevalue
- new parameter valuepublic void removeParameter(java.lang.String name)
name
- parameter namepublic java.util.Iterator getParameterNames()
Iterator
over the names (Strings
)
of all parameters present in this SipURI
.Iterator
over all parameter namespublic java.lang.String getTransportParam()
getParameter("transport")
.public void setTransportParam(java.lang.String transport)
This method is equivalent to
setParameter("transport", transport)
.
transport
- new value for the "transport" parameterpublic java.lang.String getMAddrParam()
getParameter("maddr")
.public void setMAddrParam(java.lang.String maddr)
setParameter("maddr", maddr)
.method
- new value of the "maddr" parameterpublic java.lang.String getMethodParam()
getParameter("method")
.public void setMethodParam(java.lang.String method)
This method is equivalent to
setParameter("method", method)
.
method
- new value of the "method" parameterpublic int getTTLParam()
getParameter("ttl")
.public void setTTLParam(int ttl)
This is equivalent to setParameter("ttl", ttl)
.
ttl
- new value of the "ttl" parameterpublic java.lang.String getUserParam()
getParameter("user")
.public void setUserParam(java.lang.String user)
setParameter("user", user)
.user
- new value for the "user" parameterpublic boolean getLrParam()
"".equals(getParameter("lr"))
.public void setLrParam(boolean flag)
flag
- specifies that the "lr" flag parameter is to be set (true)
or removed (false)public java.lang.String getHeader(java.lang.String name)
sip:joe@example.com?Priority=emergency
has a header
"Priority" whose value is "emergency".name
- the header nameSipURI
public void setHeader(java.lang.String name, java.lang.String value)
SipURI
.name
- header namevalue
- header valuepublic java.util.Iterator getHeaderNames()
Iterator
over the names of all headers
present in this SipURI
.Iterator
over all header namespublic java.lang.String toString()
String
representation of this
SipURI
.toString
in interface URI
toString
in class java.lang.Object
sip
or sips
URI as a
String
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |