JSIP API v1.2
November 2006

javax.sip.message
Interface MessageFactory


public interface MessageFactory

This interface provides factory methods that allow an application to create Request and Response messages from a particular implementation of JAIN SIP. This class is a singleton and can be retrieved from the SipFactory.createMessageFactory().

Author:
BEA Systems, NIST

Method Summary
 Request createRequest(java.lang.String request)
          Create a new SIP Request object based on a specific string value.
 Request createRequest(URI requestURI, java.lang.String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.List via, MaxForwardsHeader maxForwards)
          Creates a new Request message of type specified by the method paramater, containing the URI of the Request, the mandatory headers of the message.
 Request createRequest(URI requestURI, java.lang.String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, byte[] content)
          Creates a new Request message of type specified by the method paramater, containing the URI of the Request, the mandatory headers of the message with a body in the form of a byte array and body content type.
 Request createRequest(URI requestURI, java.lang.String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, java.lang.Object content)
          Creates a new Request message of type specified by the method paramater, containing the URI of the Request, the mandatory headers of the message with a body in the form of a Java object and the body content type.
 Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.List via, MaxForwardsHeader maxForwards)
          Creates a new Response message of type specified by the statusCode paramater, containing the mandatory headers of the message.
 Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, byte[] content)
          Creates a new Response message of type specified by the statusCode paramater, containing the mandatory headers of the message with a body in the form of a byte array and the body content type.
 Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, java.lang.Object content)
          Creates a new Response message of type specified by the statusCode paramater, containing the mandatory headers of the message with a body in the form of a Java object and the body content type.
 Response createResponse(int statusCode, Request request)
          Creates a new Response message of type specified by the statusCode paramater, based on a specific Request message.
 Response createResponse(int statusCode, Request request, ContentTypeHeader contentType, byte[] content)
          Creates a new Response message of type specified by the statusCode paramater, based on a specific Request with a new body in the form of a byte array and the body content type.
 Response createResponse(int statusCode, Request request, ContentTypeHeader contentType, java.lang.Object content)
          Creates a new Response message of type specified by the statusCode paramater, based on a specific Request with a new body in the form of a Java object and the body content type.
 Response createResponse(java.lang.String response)
          Creates a Response from a String.
 

Method Detail

createRequest

Request createRequest(URI requestURI,
                      java.lang.String method,
                      CallIdHeader callId,
                      CSeqHeader cSeq,
                      FromHeader from,
                      ToHeader to,
                      java.util.List via,
                      MaxForwardsHeader maxForwards,
                      ContentTypeHeader contentType,
                      java.lang.Object content)
                      throws java.text.ParseException
Creates a new Request message of type specified by the method paramater, containing the URI of the Request, the mandatory headers of the message with a body in the form of a Java object and the body content type.

Parameters:
requestURI - the new URI object of the requestURI value of this Message.
method - the new string of the method value of this Message.
callId - the new CallIdHeader object of the callId value of this Message.
cSeq - the new CSeqHeader object of the cSeq value of this Message.
from - the new FromHeader object of the from value of this Message.
to - the new ToHeader object of the to value of this Message.
via - the new List object of the ViaHeaders of this Message.
contentType - the new ContentTypeHeader object of the content type value of this Message.
content - the new Object of the body content value of this Message.
Returns:
the newly created Request object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the method or the body.

createRequest

Request createRequest(URI requestURI,
                      java.lang.String method,
                      CallIdHeader callId,
                      CSeqHeader cSeq,
                      FromHeader from,
                      ToHeader to,
                      java.util.List via,
                      MaxForwardsHeader maxForwards,
                      ContentTypeHeader contentType,
                      byte[] content)
                      throws java.text.ParseException
Creates a new Request message of type specified by the method paramater, containing the URI of the Request, the mandatory headers of the message with a body in the form of a byte array and body content type.

Parameters:
requestURI - the new URI object of the requestURI value of this Message.
method - the new string of the method value of this Message.
callId - the new CallIdHeader object of the callId value of this Message.
cSeq - the new CSeqHeader object of the cSeq value of this Message.
from - the new FromHeader object of the from value of this Message.
to - the new ToHeader object of the to value of this Message.
via - the new List object of the ViaHeaders of this Message.
contentType - the new ContentTypeHeader object of the content type value of this Message.
content - the new byte array of the body content value of this Message.
Returns:
the newly created Request object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the method or the body.

createRequest

Request createRequest(URI requestURI,
                      java.lang.String method,
                      CallIdHeader callId,
                      CSeqHeader cSeq,
                      FromHeader from,
                      ToHeader to,
                      java.util.List via,
                      MaxForwardsHeader maxForwards)
                      throws java.text.ParseException
Creates a new Request message of type specified by the method paramater, containing the URI of the Request, the mandatory headers of the message. This new Request does not contain a body.

Parameters:
requestURI - the new URI object of the requestURI value of this Message.
method - the new string of the method value of this Message.
callId - the new CallIdHeader object of the callId value of this Message.
cSeq - the new CSeqHeader object of the cSeq value of this Message.
from - the new FromHeader object of the from value of this Message.
to - the new ToHeader object of the to value of this Message.
via - the new List object of the ViaHeaders of this Message.
Returns:
the newly created Request object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the method.

createRequest

Request createRequest(java.lang.String request)
                      throws java.text.ParseException
Create a new SIP Request object based on a specific string value. This method parses the supplied string into a SIP Request. The request string should only consist of the SIP portion of the Request and not the content. Supplying a null argument creates an empty SIP Request which may be used to end out "keep alive" messages for a connection.

Parameters:
request - the new string value of the Request.
Returns:
the newly created Request object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the request.

createResponse

Response createResponse(int statusCode,
                        CallIdHeader callId,
                        CSeqHeader cSeq,
                        FromHeader from,
                        ToHeader to,
                        java.util.List via,
                        MaxForwardsHeader maxForwards,
                        ContentTypeHeader contentType,
                        java.lang.Object content)
                        throws java.text.ParseException
Creates a new Response message of type specified by the statusCode paramater, containing the mandatory headers of the message with a body in the form of a Java object and the body content type.

Parameters:
statusCode - the new integer of the statusCode value of this Message.
callId - the new CallIdHeader object of the callId value of this Message.
cSeq - the new CSeqHeader object of the cSeq value of this Message.
from - the new FromHeader object of the from value of this Message.
to - the new ToHeader object of the to value of this Message.
via - the new List object of the ViaHeaders of this Message.
contentType - the new ContentTypeHeader object of the content type value of this Message.
content - the new Object of the body content value of this Message.
Returns:
the newly created Response object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the statusCode or the body.

createResponse

Response createResponse(int statusCode,
                        CallIdHeader callId,
                        CSeqHeader cSeq,
                        FromHeader from,
                        ToHeader to,
                        java.util.List via,
                        MaxForwardsHeader maxForwards,
                        ContentTypeHeader contentType,
                        byte[] content)
                        throws java.text.ParseException
Creates a new Response message of type specified by the statusCode paramater, containing the mandatory headers of the message with a body in the form of a byte array and the body content type.

Parameters:
statusCode - the new integer of the statusCode value of this Message.
callId - the new CallIdHeader object of the callId value of this Message.
cSeq - the new CSeqHeader object of the cSeq value of this Message.
from - the new FromHeader object of the from value of this Message.
to - the new ToHeader object of the to value of this Message.
via - the new List object of the ViaHeaders of this Message.
contentType - the new ContentTypeHeader object of the content type value of this Message.
content - the new byte array of the body content value of this Message.
Returns:
the newly created Response object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the statusCode or the body.

createResponse

Response createResponse(int statusCode,
                        CallIdHeader callId,
                        CSeqHeader cSeq,
                        FromHeader from,
                        ToHeader to,
                        java.util.List via,
                        MaxForwardsHeader maxForwards)
                        throws java.text.ParseException
Creates a new Response message of type specified by the statusCode paramater, containing the mandatory headers of the message. This new Response does not contain a body.

Parameters:
statusCode - the new integer of the statusCode value of this Message.
callId - the new CallIdHeader object of the callId value of this Message.
cSeq - the new CSeqHeader object of the cSeq value of this Message.
from - the new FromHeader object of the from value of this Message.
to - the new ToHeader object of the to value of this Message.
via - the new List object of the ViaHeaders of this Message.
Returns:
the newly created Response object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the statusCode.

createResponse

Response createResponse(int statusCode,
                        Request request,
                        ContentTypeHeader contentType,
                        java.lang.Object content)
                        throws java.text.ParseException
Creates a new Response message of type specified by the statusCode paramater, based on a specific Request with a new body in the form of a Java object and the body content type. Only the required headers are copied from the Request.

Parameters:
statusCode - the new integer of the statusCode value of this Message.
request - the received Reqest object upon which to base the Response.
contentType - the new ContentTypeHeader object of the content type value of this Message.
content - the new Object of the body content value of this Message.
Returns:
the newly created Response object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the statusCode or the body.

createResponse

Response createResponse(int statusCode,
                        Request request,
                        ContentTypeHeader contentType,
                        byte[] content)
                        throws java.text.ParseException
Creates a new Response message of type specified by the statusCode paramater, based on a specific Request with a new body in the form of a byte array and the body content type. Only the required headers are copied from the Request.

Parameters:
statusCode - the new integer of the statusCode value of this Message.
request - the received Reqest object upon which to base the Response.
contentType - the new ContentTypeHeader object of the content type value of this Message.
content - the new byte array of the body content value of this Message.
Returns:
the newly created Response object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the statusCode or the body.

createResponse

Response createResponse(int statusCode,
                        Request request)
                        throws java.text.ParseException
Creates a new Response message of type specified by the statusCode paramater, based on a specific Request message. This new Response does not contain a body. Only the required headers are copied from the Request.

Parameters:
statusCode - the new integer of the statusCode value of this Message.
request - the received Reqest object upon which to base the Response.
Returns:
the newly created Response object.
Throws:
java.text.ParseException - which signals that an error has been reached unexpectedly while parsing the statusCode.

createResponse

Response createResponse(java.lang.String response)
                        throws java.text.ParseException
Creates a Response from a String. This method parses the supplied string into a SIP Response. The response string should only consist of the SIP portion of the Response and not the content.

Parameters:
response - is a string representing the response. The argument should only contain the Sip Headers and not the body of the response.
Throws:
java.text.ParseException - which signals an error has been reached unexpectedly while parsing the response.
Since:
v1.2

JSIP API v1.2
November 2006

If you have any comments, please mail them to JAIN-SIP-INTEREST@java.sun.com after subscribing at http://archives.java.sun.com
Copyright - 2006 BEA Systems and Sun Microsystems