public class MessageFactoryImpl extends Object implements MessageFactory, MessageFactoryExt
Constructor and Description |
---|
MessageFactoryImpl()
Creates a new instance of MessageFactoryImpl
|
Modifier and Type | Method and Description |
---|---|
MultipartMimeContent |
createMultipartMimeContent(ContentTypeHeader multipartMimeCth,
String[] contentType,
String[] contentSubtype,
String[] contentBody)
Create a MultipartMime attachment from a list of content type, subtype and content.
|
Request |
createRequest(String requestString)
Create a request from a string.
|
Request |
createRequest(URI requestURI,
String method,
CallIdHeader callId,
CSeqHeader cSeq,
FromHeader from,
ToHeader to,
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,
String method,
CallIdHeader callId,
CSeqHeader cSeq,
FromHeader from,
ToHeader to,
List via,
MaxForwardsHeader maxForwards,
byte[] content,
ContentTypeHeader contentType)
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,
String method,
CallIdHeader callId,
CSeqHeader cSeq,
FromHeader from,
ToHeader to,
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,
String method,
CallIdHeader callId,
CSeqHeader cSeq,
FromHeader from,
ToHeader to,
List via,
MaxForwardsHeader maxForwards,
ContentTypeHeader contentType,
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,
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,
List via,
MaxForwardsHeader maxForwards,
byte[] content,
ContentTypeHeader contentType)
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,
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,
List via,
MaxForwardsHeader maxForwards,
ContentTypeHeader contentType,
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,
CallIdHeader callId,
CSeqHeader cSeq,
FromHeader from,
ToHeader to,
List via,
MaxForwardsHeader maxForwards,
Object content,
ContentTypeHeader contentType)
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,
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(String responseString)
Create a response from a string
|
static String |
getDefaultContentEncodingCharset() |
static ServerHeader |
getDefaultServerHeader()
Get the default common server header.
|
static UserAgentHeader |
getDefaultUserAgentHeader()
Get the default common UserAgentHeader.
|
void |
setDefaultContentEncodingCharset(String charset)
Set default charset used for encoding String content.
|
void |
setDefaultServerHeader(ServerHeader server)
Set the common Server header for all responses created from this message factory.
|
void |
setDefaultUserAgentHeader(UserAgentHeader userAgent)
Set the common UserAgent header for all requests created from this message factory.
|
void |
setStrict(boolean strict) |
void |
setTest(boolean flag)
This is for testing -- allows you to generate invalid requests
|
public MessageFactoryImpl()
public void setStrict(boolean strict)
public void setTest(boolean flag)
public Request createRequest(URI requestURI, String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, Object content) throws ParseException
createRequest
in interface MessageFactory
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.content
- -
the new Object of the body content value of this Message.contentType
- -
the new ContentTypeHeader object of the content type value of
this Message.ParseException
- which signals that an error has been reached unexpectedly
while parsing the method or the body.public Request createRequest(URI requestURI, String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards, byte[] content, ContentTypeHeader contentType) throws ParseException
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.content
- -
the new byte array of the body content value of this Message.contentType
- -
the new ContentTypeHeader object of the content type value of
this Message.ParseException
- which signals that an error has been reached unexpectedly
while parsing the method or the body.public Request createRequest(URI requestURI, String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards) throws ParseException
createRequest
in interface MessageFactory
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.ParseException
- which signals that an error has been reached unexpectedly
while parsing the method.public Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards, Object content, ContentTypeHeader contentType) throws ParseException
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.content
- -
the new Object of the body content value of this Message.contentType
- -
the new ContentTypeHeader object of the content type value of
this Message.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode or the body.public Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards, byte[] content, ContentTypeHeader contentType) throws ParseException
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.content
- -
the new byte array of the body content value of this Message.contentType
- -
the new ContentTypeHeader object of the content type value of
this Message.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode or the body.public Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards) throws ParseException
createResponse
in interface MessageFactory
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.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode.public Response createResponse(int statusCode, Request request, ContentTypeHeader contentType, Object content) throws ParseException
createResponse
in interface MessageFactory
statusCode
- -
the new integer of the statusCode value of this Message.request
- -
the received Reqest object upon which to base the Response.content
- -
the new Object of the body content value of this Message.contentType
- -
the new ContentTypeHeader object of the content type value of
this Message.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode or the body.public Response createResponse(int statusCode, Request request, ContentTypeHeader contentType, byte[] content) throws ParseException
createResponse
in interface MessageFactory
statusCode
- -
the new integer of the statusCode value of this Message.request
- -
the received Reqest object upon which to base the Response.content
- -
the new byte array of the body content value of this Message.contentType
- -
the new ContentTypeHeader object of the content type value of
this Message.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode or the body.public Response createResponse(int statusCode, Request request) throws ParseException
createResponse
in interface MessageFactory
statusCode
- -
the new integer of the statusCode value of this Message.request
- -
the received Reqest object upon which to base the Response.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode.public Request createRequest(URI requestURI, String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, byte[] content) throws ParseException
createRequest
in interface MessageFactory
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.ParseException
- which signals that an error has been reached unexpectedly
while parsing the method or the body.public Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, Object content) throws ParseException
createResponse
in interface MessageFactory
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.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode or the body.public Response createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, List via, MaxForwardsHeader maxForwards, ContentTypeHeader contentType, byte[] content) throws ParseException
createResponse
in interface MessageFactory
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.ParseException
- which signals that an error has been reached unexpectedly
while parsing the statusCode or the body.public Request createRequest(String requestString) throws ParseException
createRequest
in interface MessageFactory
requestString
- --
string from which to create the message null string returns an
empty message.ParseException
- which signals that an error has been reached
unexpectedly while parsing the request.public Response createResponse(String responseString) throws ParseException
createResponse
in interface MessageFactory
responseString
- --
string from which to create the message null string returns an
empty message.ParseException
- which signals an error has been reached unexpectedly
while parsing the response.public void setDefaultUserAgentHeader(UserAgentHeader userAgent)
setDefaultUserAgentHeader
in interface MessageFactoryExt
userAgent
- -- the user agent header to set.public void setDefaultServerHeader(ServerHeader server)
setDefaultServerHeader
in interface MessageFactoryExt
userAgent
- -- the user agent header to set.public static UserAgentHeader getDefaultUserAgentHeader()
public static ServerHeader getDefaultServerHeader()
public void setDefaultContentEncodingCharset(String charset) throws NullPointerException, IllegalArgumentException
setDefaultContentEncodingCharset
in interface MessageFactoryExt
charset
- NullPointerException
- if null argIllegalArgumentException
- if Charset is not a known charset.public static String getDefaultContentEncodingCharset()
public MultipartMimeContent createMultipartMimeContent(ContentTypeHeader multipartMimeCth, String[] contentType, String[] contentSubtype, String[] contentBody)
MessageFactoryExt
createMultipartMimeContent
in interface MessageFactoryExt
Copyright © 2018. All Rights Reserved.