javax.servlet.sip
Interface URI

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
SipURI, TelURL

public interface URI
extends java.lang.Cloneable

Base interface for any type of URI. These are used in the request line of SIP requests to identify the callee and also in Contact, From, and To headers.

The only feature common to all URIs is that they can be represented as strings beginning with a token identifying the scheme of the URI followed by a colon followed by a scheme-specific part.

The generic syntax of URIs is defined in RFC 2396.


Method Summary
 URI clone()
          Returns a clone of this URI.
 boolean equals(java.lang.Object o)
          Compares the given URI with this URI.
 java.lang.String getParameter(java.lang.String key)
          Returns the value of the named parameter, or null if it is not set.
 java.util.Iterator<java.lang.String> getParameterNames()
          Returns an Iterator over the names of all parameters present in this URI.
 java.lang.String getScheme()
          Returns the scheme of this URI, for example "sip", "sips" or "tel".
 boolean isSipURI()
          Returns true if the scheme is "sip" or "sips", false otherwise.
 void removeParameter(java.lang.String name)
          Removes the named parameter from this URL.
 void setParameter(java.lang.String name, java.lang.String value)
          Sets the value of the named parameter.
 java.lang.String toString()
          Returns the value of this URI as a String.
 

Method Detail

getScheme

java.lang.String getScheme()
Returns the scheme of this URI, for example "sip", "sips" or "tel".

Returns:
the scheme of this URI

toString

java.lang.String toString()
Returns the value of this URI as a String. The result must be appropriately URL escaped.

Overrides:
toString in class java.lang.Object
Returns:
String value of this URI

isSipURI

boolean isSipURI()
Returns true if the scheme is "sip" or "sips", false otherwise.

Returns:
true if the scheme is "sip" or "sips", false otherwise

getParameter

java.lang.String getParameter(java.lang.String key)
Returns the value of the named parameter, or null if it is not set. A zero-length String indicates flag parameter.

Parameters:
key - a String specifying the parameter name
Returns:
value of the specified parameter
Throws:
java.lang.NullPointerException - if the key is null.
Since:
1.1

setParameter

void setParameter(java.lang.String name,
                  java.lang.String value)
Sets the value of the named parameter. If this URL previously contained a value for the given parameter name, then the old value is replaced by the specified value. The setting of a flag parameter is indicated by specifying a zero-length String for the parameter value.

Parameters:
name - parameter name
value - new parameter value
Throws:
java.lang.NullPointerException - on eithet name or value being null.
Since:
1.1

removeParameter

void removeParameter(java.lang.String name)
Removes the named parameter from this URL. Nothing is done if the URL did not already contain the specific parameter.

Parameters:
name - parameter name
Since:
1.1

getParameterNames

java.util.Iterator<java.lang.String> getParameterNames()
Returns an Iterator over the names of all parameters present in this URI.

Returns:
an iterator over strings containing the names of this URLs parameters
Since:
1.1

equals

boolean equals(java.lang.Object o)
Compares the given URI with this URI. The comparison rules to be followed shall depend upon the underlying URI scheme being used. For general purpose URIs RFC 2396 should be consulted for equality. If the URIs are of scheme for which comparison rules are further specified in their specications, then they must be used for any comparison.

Overrides:
equals in class java.lang.Object
Parameters:
o - the URI which is to be compared with this.
Returns:
true if the two URIs are equal as per the provisions of their specifications.
Since:
1.1

clone

URI clone()
Returns a clone of this URI.

Returns:
URI a clone of this URI object