|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.sip.SipHeader
SipHeader provides generic SIP header parser helper. This
class can be used to parse bare String header values that are read from
SIP message using e.g. SipConnection.getHeader()
method. It should be noticed that SipHeader is separate
helper class and not mandatory to use for creating SIP connections.
Correspondingly, SIP headers can be constructed with this class.
SipHeader uses generic format to parse the header value and
parameters following the syntax given in RFC 3261[1] p.31
header = header-name ":" header-value *(";" generic-param) / WWW-Authenticate / Proxy-Authenticate / Proxy-Authorization / Authorization header-name = token generic-param = token [ EQUAL gen-value ] gen-value = token / host / quoted-string header-value = 1*(chars) / name-addr chars = %x20-3A / "=" / %x3F-7E ; any visible character except ";" "<" ">"Reference, SIP 3261 [1] p.159 Header Fields and p.219 SIP BNF for terminals not defined in this BNF.
Call-ID: a84b4c76e66710
From: Bob <sip:[email protected]>;tag=a6c85cf
Contact: <sip:[email protected]>
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKhjhs8ass877
Contact: "Mr. Watson" <sip:[email protected]>;q=0.7;expires=3600
WWW-Authenticate: Digest realm="atlanta.com", domain="sip:boxesbybob.com", qop="auth", nonce="f84f1cec41e6cbe5aea9c8e88d359", opaque="", stale=FALSE, algorithm=MD5
SipAddress
Constructor Summary | |
SipHeader(java.lang.String name,
java.lang.String headerValue)
Constructs a SipHeader from name value pair. |
Method Summary | |
java.lang.String |
getHeaderValue()
Returns the full header value including parameters. |
java.lang.String |
getName()
Returns the name of this header |
java.lang.String |
getParameter(java.lang.String name)
Returns the value of one header parameter. |
java.lang.String[] |
getParameterNames()
Returns the names of header parameters. |
java.lang.String |
getValue()
Returns the header value without header parameters. |
void |
removeParameter(java.lang.String name)
Removes the header parameter, if it is found in this header. |
void |
setName(java.lang.String name)
Sets the header name, for example Contact |
void |
setParameter(java.lang.String name,
java.lang.String value)
Sets value of header parameter. |
void |
setValue(java.lang.String value)
Sets the header value as String without parameters. |
java.lang.String |
toString()
Returns the String representation of the header according to header type. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SipHeader(java.lang.String name, java.lang.String headerValue) throws java.lang.IllegalArgumentException
name = Contact
value = <sip:[email protected]>;expires=3600
name
- name of the header (Contact, Call-ID, ...)headerValue
- full header value as String
java.lang.IllegalArgumentException
- if the header value or name are invalidMethod Detail |
public void setName(java.lang.String name) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the name is invalidpublic java.lang.String getName()
public java.lang.String getValue()
<sip:[email protected]>;expires=3600
method returns <sip:[email protected]>
public java.lang.String getHeaderValue()
public void setValue(java.lang.String value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the value is invalid or there is parameters included.public java.lang.String getParameter(java.lang.String name)
name
- name of the header parameter
public java.lang.String[] getParameterNames()
public void setParameter(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
name
- name of the header parametervalue
- value of the parameter
java.lang.IllegalArgumentException
- if the parameter name or value are invalidpublic void removeParameter(java.lang.String name)
name
- name of the header parameterpublic java.lang.String toString()
WWW-Authenticate: Digest realm="atlanta.com", domain="sip:boxesbybob.com", qop="auth", nonce="f84f1cec41e6cbe5aea9c8e88d359", opaque="", stale=FALSE, algorithm=MD5
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |