|
JSIP API v1.2 November 2006 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Message
A SIP message is either a request from a client to a server, or a response from a server to a client. Both Request and Response messages use the basic format of RFC 2822, even though the syntax differs in character set and syntax specifics. (SIP allows header fields that would not be valid RFC 2822 header fields, for example.) Both types of messages consist of a method name, address and protocol version, one or more header fields which describe the routing of the message, and an optional message-body. The message-body contains a session description in a format such as Session Description Protocol see JSR 141.
This interface contains common elements of both Request and Response such as:
Although the SIP Protocol allows headers of a given kind to be interspaced with headers of different kinds, an implementation of this specification is required to organize headers so that headers that can appear multiple times in a SIP Message (such as the Via header) are grouped together and can be retrieved collectively and iterated over. Although an implementation may use short forms internally, the specification refers to all headers by their long form names.
Request
,
Response
,
Header
Method Summary | |
---|---|
void |
addFirst(Header header)
Adds the new Header to the head of the existing list of Headers contained in this Message. |
void |
addHeader(Header header)
Adds the new Header to the existing list of Headers contained in this Message. |
void |
addLast(Header header)
Adds the new Header to the end of existing list of Headers contained in this Message. |
java.lang.Object |
clone()
Creates and returns a deep copy of the Message. |
boolean |
equals(java.lang.Object object)
Compare this SIP Message for equality with another. |
java.lang.Object |
getContent()
Gets the body content of the Message as an Object. |
ContentDispositionHeader |
getContentDisposition()
Gets the ContentDispositionHeader of this Message. |
ContentEncodingHeader |
getContentEncoding()
Gets the ContentEncodingHeader of this Message. |
ContentLanguageHeader |
getContentLanguage()
Gets the ContentLanguageHeader of this Message. |
ContentLengthHeader |
getContentLength()
Gets the ContentLengthHeader of the body content of this Message. |
ExpiresHeader |
getExpires()
Gets the ExpiresHeader of this Message. |
Header |
getHeader(java.lang.String headerName)
Gets the Header of the specified name in this Message. |
java.util.ListIterator |
getHeaderNames()
Gets a ListIterator over the set of all all the header names in this Message. |
java.util.ListIterator |
getHeaders(java.lang.String headerName)
Gets a ListIterator over all the Headers of the newly specified name in this Message. |
byte[] |
getRawContent()
Gets the body content of the Message as a byte array. |
java.lang.String |
getSIPVersion()
Gets the protocol version of SIP being used by this Message. |
java.util.ListIterator |
getUnrecognizedHeaders()
Returns a ListIterator over all the UnrecognizedHeaders in this Message. |
int |
hashCode()
Gets a integer hashcode representation of the Header. |
void |
removeContent()
Removes the body content from this Message and all associated entity headers, if a body exists, this method returns sliently if no body exists. |
void |
removeFirst(java.lang.String headerName)
Removes the first header from a list of headers. |
void |
removeHeader(java.lang.String headerName)
Removes the Header of the supplied name from the list of headers in this Message. |
void |
removeLast(java.lang.String headerName)
Removes the last header from a list of headers. |
void |
setContent(java.lang.Object content,
ContentTypeHeader contentTypeHeader)
Sets the body of this Message, with the ContentType defined by the new ContentTypeHeader object and the string value of the content. |
void |
setContentDisposition(ContentDispositionHeader contentDisposition)
Sets the ContentDispositionHeader of this Message. |
void |
setContentEncoding(ContentEncodingHeader contentEncoding)
Sets the ContentEncodingHeader of this Message. |
void |
setContentLanguage(ContentLanguageHeader contentLanguage)
Sets the ContentLanguageHeader of this Message. |
void |
setContentLength(ContentLengthHeader contentLength)
Set the ContentLengthHeader of this Message. |
void |
setExpires(ExpiresHeader expires)
Sets the ExpiresHeader of this Message. |
void |
setHeader(Header header)
Sets the new Header to replace existings Header of that type in the message. |
void |
setSIPVersion(java.lang.String version)
Sets the protocol version of SIP being used by this Message. |
java.lang.String |
toString()
Gets string representation of Message |
Method Detail |
---|
void addHeader(Header header)
Required Headers that are singletons should not be added to the message
as they already exist in the message and therefore should be changed using
the setHeader(Header)
method.
This method should be used to support the special case of adding required ViaHeaders to a message. When adding a ViaHeader using this method the implementation will add the ViaHeader to the top of the ViaHeader list, and not the end like all other Headers.
header
- the new Header to be added to the existing Headers List.void addLast(Header header) throws SipException, java.lang.NullPointerException
Required Headers that are singletons should not be added to the message
as they already exist in the message and therefore should be changed using
the setHeader(Header)
method. This does the same thing
as addHeader in all cases including the Via header.
Add a header explicitly to the end of a list of headers.
header
- -- the new Header to be added to the end of the existing
list of headers
java.lang.NullPointerException
- -- if the argument is null.
SipException
- -- if the header is a singleton and an instance of the header
already exists.void addFirst(Header header) throws SipException, java.lang.NullPointerException
Required Headers that are singletons should not be added to the message
as they already exist in the message and therefore should be
changed using the setHeader(Header)
method.
header
- the new Header to be added to the existing Headers List.
SipException
- -- if the header to be added is a singleton and an instance of the header
already exists.
java.lang.NullPointerException
- -- if the argument is null.void removeFirst(java.lang.String headerName) throws java.lang.NullPointerException
headerName
- the name of the header to be removed.
java.lang.NullPointerException
- -- if the arg is nullvoid removeLast(java.lang.String headerName) throws java.lang.NullPointerException
headerName
- the name of the header to be removed.
java.lang.NullPointerException
void removeHeader(java.lang.String headerName)
setHeader(Header)
.
headerName
- the new string value name of the Header to be
removed.java.util.ListIterator getHeaderNames()
java.util.ListIterator getHeaders(java.lang.String headerName)
headerName
- the new string name of Header types requested.
Header getHeader(java.lang.String headerName)
headerName
- the new string name of Header type requested.
java.util.ListIterator getUnrecognizedHeaders()
void setHeader(Header header)
header
- the new Header to replace any existing Headers of that
type.void setContentLength(ContentLengthHeader contentLength)
contentLength
- the new ContentLengthHeader object containing the
content length value of this Message.ContentLengthHeader getContentLength()
this.getHeader(Content-Length);
void setContentLanguage(ContentLanguageHeader contentLanguage)
contentLanguage
- the new ContentLanguageHeader object containing the
content language value of this Message.ContentLanguageHeader getContentLanguage()
this.getHeader(Content-Langauge);
void setContentEncoding(ContentEncodingHeader contentEncoding)
contentEncoding
- the new ContentEncodingHeader object containing the
content encoding values of this Message.ContentEncodingHeader getContentEncoding()
this.getHeader(Content-Encoding);
void setContentDisposition(ContentDispositionHeader contentDisposition)
contentDisposition
- the new ContentDispositionHeader object
containing the content disposition value of this Message.ContentDispositionHeader getContentDisposition()
this.getHeader(Content-Disposition);
void setContent(java.lang.Object content, ContentTypeHeader contentTypeHeader) throws java.text.ParseException
content
- the new Object value of the content of the Message.contentTypeHeader
- the new ContentTypeHeader object that defines
the content type value.
java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the body.byte[] getRawContent()
java.lang.Object getContent()
void removeContent()
void setExpires(ExpiresHeader expires)
expires
- the new ExpiresHeader object containing the expires
values of this Message.ExpiresHeader getExpires()
this.getHeader(Expires);
void setSIPVersion(java.lang.String version) throws java.text.ParseException
version
- the new String object containing the version of the SIP
Protocol of this Message.
java.text.ParseException
- which signals that an error has been reached
unexpectedly while parsing the version argument.java.lang.String getSIPVersion()
java.lang.Object clone()
boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- the object to compare this Message with.
true
if obj
is an instance of this class representing the same SIP Message as
this (on the basis of comparing the headers above),
false
otherwise.int hashCode()
hashCode
in class java.lang.Object
java.lang.String toString()
toString
in class java.lang.Object
|
JSIP API v1.2 November 2006 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |