Skip navigation links

Oracle Communications Service Broker
SAL API Reference Reference
Release 6.0

E26227-01


com.convergin.common.sal.ext.api
Interface SalMessage

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
SalRequest, SalResponse

public interface SalMessage
extends java.lang.Cloneable

Defines common aspects of SIP requests and responses.

The SalMessage interface defines a number of methods which are common to SalRequest and SalResponse, for example setters and getters for message headers and content.


Method Summary
 void addAddressHeader(java.lang.String name, Address value, boolean first)
          Adds the specified Address as a new value of the named header field.
 void addHeader(java.lang.String name, java.lang.String value)
          Adds a header with the given name and value.
 Address getAddressHeader(java.lang.String name)
          Returns the value of the specified header as a Address object.
 java.util.ListIterator<Address> getAddressHeaders(java.lang.String name)
          Returns a ListIterator over all Address header field values for the specified header.
 SalApplicationSession getApplicationSession()
          Returns the application session to which this message belongs.
 SalApplicationSession getApplicationSession(boolean create)
          Returns the application session to which this message belongs.
 java.lang.Object getContent()
          Returns the content as a Java object.
 java.lang.String getContentType()
          Returns the value of the Content-Type header field.
 Address getFrom()
          Returns the value of the From header.
 java.lang.String getHeader(java.lang.String name)
          Returns the value of the specified header as a String.
 java.util.Iterator<java.lang.String> getHeaderNames()
          Returns an Iterator over all the header names this message contains.
 java.util.ListIterator<java.lang.String> getHeaders(java.lang.String name)
          Returns all the values of the specified header as a ListIterator over a number of String objects.
 java.lang.String getMethod()
          Returns the SAL method of this message.
 SalSession getSession()
          Returns the SalSession to which this message belongs.
 SalSession getSession(boolean create)
          Returns the SalSession to which this message belongs.
 Address getTo()
          Returns the value of the To header.
 void removeHeader(java.lang.String name)
          Removes the specified header.
 void setAddressHeader(java.lang.String name, Address value)
          Sets the header with the specified name to have the value specified by the address argument.
 void setContent(java.lang.Object content, java.lang.String contentType)
          Sets the content of this message to the specified Object.
 void setContentType(java.lang.String _type)
          Sets the content type of the message
 void setHeader(java.lang.String name, java.lang.String value)
          Sets a header with the given name and value.

 

Method Detail

getFrom

Address getFrom()
Returns the value of the From header.
Returns:
internal representation of the From header

getTo

Address getTo()
Returns the value of the To header.
Returns:
internal representation of the To header

getMethod

java.lang.String getMethod()
Returns the SAL method of this message. This is a token consisting of all upper-case letters, for example "INVITE". For requests, the SAL method is in the request line while for responses it may be extracted from the CSeq header.
Returns:
the SAL method of this SalMessage

getHeader

java.lang.String getHeader(java.lang.String name)
Returns the value of the specified header as a String. If the message did not include a header of the specified name, this method returns null. If the message included a header of the specified name with no value, this method returns an empty String. If multiple headers exist, the first one is returned. The header name is case insensitive.
Parameters:
name - a String specifying the header name, either the long or compact form
Returns:
a String containing the value of the requested header, or null if the message does not have a header of that name

getHeaders

java.util.ListIterator<java.lang.String> getHeaders(java.lang.String name)
Returns all the values of the specified header as a ListIterator over a number of String objects. The values returned by the Iterator follow the order in which they appear in the message header.
Parameters:
name - a String specifying the header name, either the long or compact form
Returns:
a ListIterator over the String values of the specified header field

getHeaderNames

java.util.Iterator<java.lang.String> getHeaderNames()
Returns an Iterator over all the header names this message contains. If the message has no headers, this method returns an empty Iterator.
Returns:
an Iterator over the names of all header fields present within this message; if the message has no header fields, an empty enumeration;

setHeader

void setHeader(java.lang.String name,
               java.lang.String value)
Sets a header with the given name and value. If the header had already been set, the new value overwrites the previous one. If there are multiple headers with the same name, they all are replaced by this header name, value pair.
Parameters:
name - a String specifying the header name, either the long or compact form
value - the header value

addHeader

void addHeader(java.lang.String name,
               java.lang.String value)
Adds a header with the given name and value. This method allows headers to have multiple values.
Parameters:
name - a String specifying the header name, either the long or compact form
value - the additional header value

removeHeader

void removeHeader(java.lang.String name)
Removes the specified header. If multiple headers exists with the given name, they're all removed.
Parameters:
name - a String specifying the header name, either the long or compact form

getAddressHeader

Address getAddressHeader(java.lang.String name)
                         throws SalApplicationParseException
Returns the value of the specified header as a Address object.
Parameters:
name - a case insensitive String specifying the name of the header, either the long or compact form
Returns:
value of the header as an Address
Throws:
SalApplicationParseException

getAddressHeaders

java.util.ListIterator<Address> getAddressHeaders(java.lang.String name)
                                                  throws SalApplicationParseException
Returns a ListIterator over all Address header field values for the specified header. The values returned by the Iterator follow the order in which they appear in the message header.
Parameters:
name - a case insensitive String specifying the name of the header field, either the long or compact form
Returns:
a ListIterator over the Address values of the specified header field
Throws:
SalApplicationParseException

setAddressHeader

void setAddressHeader(java.lang.String name,
                      Address value)
Sets the header with the specified name to have the value specified by the address argument.
Parameters:
name - the long or compact name of the header to set
value - the assigned address value

addAddressHeader

void addAddressHeader(java.lang.String name,
                      Address value,
                      boolean first)
Adds the specified Address as a new value of the named header field. The address is added as the last header field value.
Parameters:
name - the long or compact name of the header to set
value - the additional address value
first - if true, the address is added as the first value of the specified header field, otherwise it will be the last

getContentType

java.lang.String getContentType()
Returns the value of the Content-Type header field.
Returns:
a String containing the name of the MIME type of this message, or null if the body is empty

setContentType

void setContentType(java.lang.String _type)
Sets the content type of the message
Parameters:
_type - the content type of the message

getContent

java.lang.Object getContent()
                            throws java.io.IOException,
                                   java.io.UnsupportedEncodingException
Returns the content as a Java object. The actual type of the returned object depends on the MIME type of the content itself (the Content-Type). MessageContent is returned for MIME type MultiPart. For non-MultiPart content, the original object is returned and should be tranformed into/from string using a transformer.

The object returned for "multipart" MIME content is a MessageContent.

For other objects, they are returned as they were set.

Returns:
an object representing the parsed content
Throws:
java.io.IOException
java.io.UnsupportedEncodingException

setContent

void setContent(java.lang.Object content,
                java.lang.String contentType)
                throws java.io.UnsupportedEncodingException
Sets the content of this message to the specified Object. If the type is MultiPart, the object should be a MessageContent.
Parameters:
content - an object representing the message content
contentType - MIME type of the object
Throws:
java.io.UnsupportedEncodingException

getSession

SalSession getSession()
Returns the SalSession to which this message belongs. If the session didn't already exist it is created. This method is equivalent to calling getSession(true).
Returns:
the SalSession to which this SipServletMessage belongs

getSession

SalSession getSession(boolean create)
Returns the SalSession to which this message belongs.
Parameters:
create - indicates whether the session is created if it doesn't already exist
Returns:
the SalSession to which this SalMessage belongs, or null if one hasn't been created and create is false

getApplicationSession

SalApplicationSession getApplicationSession()
Returns the application session to which this message belongs. If the session doesn't already exist it is created.
Returns:
the application session to which this SipServletMessage belongs

getApplicationSession

SalApplicationSession getApplicationSession(boolean create)
Returns the application session to which this message belongs.
Returns:
if true the session is created if it didn't already exist, otherwise null is returned

Skip navigation links

Oracle Communications Service Broker
SAL API Reference Reference
Release 6.0

E26227-01


Copyright © 2011, Oracle and/or its affiliates. All rights reserved.