javax.servlet.sip
Interface TelURL

All Superinterfaces:
java.lang.Cloneable, URI

public interface TelURL
extends URI

Represents tel URLs as defined by RFC 3966. Tel URLs represent telephone numbers. SIP servlet containers may be able to route requests based on tel URLs but are not required to.

See Also:
RFC 3966

Method Summary
 boolean equals(java.lang.Object o)
          Compares the given TelURL with this TelURL.
 java.lang.String getPhoneContext()
          Returns the phone context of this TelURL for local numbers or null if the phone number is global
 java.lang.String getPhoneNumber()
          Returns the phone number of this TelURL.
 boolean isGlobal()
          Returns true if this TelURL is global, and false otherwise.
 void setPhoneNumber(java.lang.String number)
          Sets the (global) phone number of this TelURL.
 void setPhoneNumber(java.lang.String number, java.lang.String phoneContext)
          Sets the (local) phone number of this TelURL.
 java.lang.String toString()
          Returns the String representation of this TelURL.
 
Methods inherited from interface javax.servlet.sip.URI
clone, getParameter, getParameterNames, getScheme, isSipURI, removeParameter, setParameter
 

Method Detail

getPhoneNumber

java.lang.String getPhoneNumber()
Returns the phone number of this TelURL. The returned string includes any visual separators present in the phone number part of the URL but does not include a leading "+" for global tel URLs.

Returns:
the number of this TelURL

getPhoneContext

java.lang.String getPhoneContext()
Returns the phone context of this TelURL for local numbers or null if the phone number is global

Returns:
the phone-context of this TelURL for local numbers or null if the phone number is global
Since:
1.1

setPhoneNumber

void setPhoneNumber(java.lang.String number)
Sets the (global) phone number of this TelURL. The specified number must be a valid global number for the "tel" scheme as described in RFC3966 (URLs for Telephone Calls). The following usage of this method will result in valid global phone number:
setPhoneNumber("+1-201-555-0123")

Parameters:
number - the new global phone number
Throws:
java.lang.IllegalArgumentException - if the phone number was invalid according to validation rules specified in RFC3966
Since:
1.1

setPhoneNumber

void setPhoneNumber(java.lang.String number,
                    java.lang.String phoneContext)
Sets the (local) phone number of this TelURL. The specified number must be a local phone number for the "tel" scheme as described in RFC3966 (URLs for Telephone Calls). The following usage of this method will result in a valid local phone number:
setPhoneNumber("7042","example.com")

Parameters:
number - the new local phone number
phoneContext - the phone-context parameter of this TelURI
Throws:
java.lang.IllegalArgumentException - if the phone number was invalid according to validation rules specified in RFC3966
Since:
1.1

isGlobal

boolean isGlobal()
Returns true if this TelURL is global, and false otherwise.

Returns:
true if this tel URL is in global form

toString

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

Specified by:
toString in interface URI
Overrides:
toString in class java.lang.Object
Returns:
the String representation of this TelURL

equals

boolean equals(java.lang.Object o)
Compares the given TelURL with this TelURL. The comparison rules to be followed must be as specified in RFC 3966 section 5.

Specified by:
equals in interface URI
Overrides:
equals in class java.lang.Object
Parameters:
o - the TelURL which is to be compared with this.
Returns:
true if the two URLs are equal as per RFC 3966.
Since:
1.1