public interface SipURI extends URI
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.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Compares the given SipURI with this SipURI.
|
String |
getHeader(String name)
Returns the value of the specified header.
|
List<String> |
getHeaderNameList()
Returns an immutable
List of the names of all headers
present in this SipURI . |
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 named header from 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 . |
clone, getParameter, getParameterNames, getParameterNameSet, getScheme, isSipURI, removeParameter, setParameter
String getUser()
SipURI
.SipURI
void setUser(String user)
SipURI
.user
- the new user partString getUserPassword()
SipURI
,
or null if this is not set.SipURI
void setUserPassword(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 passwordString getHost()
SipURI
.SipURI
void setHost(String host)
SipURI
. This should be a fully
qualified domain name or a numeric IP address.host
- the new host nameint getPort()
SipURI
,
or -1 if this is not set.SipURI
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.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
URIvoid 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
String getTransportParam()
getParameter("transport")
.void setTransportParam(String transport)
This method is equivalent to
setParameter("transport", transport)
.
transport
- new value for the "transport" parameterString getMAddrParam()
getParameter("maddr")
.void setMAddrParam(String maddr)
setParameter("maddr", maddr)
.maddr
- new value of the "maddr" parameterString getMethodParam()
getParameter("method")
.void setMethodParam(String method)
This method is equivalent to
setParameter("method", method)
.
method
- new value of the "method" parameterint getTTLParam()
getParameter("ttl")
.void setTTLParam(int ttl)
This is equivalent to setParameter("ttl", ttl)
.
ttl
- new value of the "ttl" parameterString getUserParam()
getParameter("user")
.void setUserParam(String user)
setParameter("user", user)
.user
- new value for the "user" parameterboolean getLrParam()
"".equals(getParameter("lr"))
.void setLrParam(boolean flag)
flag
- specifies that the "lr" flag parameter is to be set (true)
or removed (false)String getHeader(String name)
sip:joe@example.com?Priority=emergency
has a header
"Priority" whose value is "emergency".name
- the header nameSipURI
NullPointerException
- if the name
is null.void setHeader(String name, String value)
SipURI
.name
- header namevalue
- header valuevoid removeHeader(String name)
SipURI
. Nothing is
done if the SipURI
did not already contain the
specific header.name
- header nameIterator<String> getHeaderNames()
Iterator
over the names of all headers
present in this SipURI
.Iterator
over all header namesList<String> getHeaderNameList()
List
of the names of all headers
present in this SipURI
.List
of all header namesString toString()
String
representation of this
SipURI
. Any reserved characters will be properly escaped
according to RFC2396.boolean equals(Object o)
Copyright © 1996-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.