MessageFactorypublic class MessageFactory extends Object Message Factory implementation |
Constructors Summary |
---|
public MessageFactory()Creates a new instance of MessageFactoryImpl
|
Methods Summary |
---|
public Request | createRequest(URI requestURI, java.lang.String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector 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.
if (requestURI == null ||
method == null ||
callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null ||
content == null ||
contentType == null)
throw new NullPointerException
("missing parameters");
Request sipRequest = new Request();
sipRequest.setRequestURI(requestURI);
sipRequest.setMethod(method);
sipRequest.setCallId(callId);
sipRequest.setHeader(cSeq);
sipRequest.setHeader(from);
sipRequest.setHeader(to);
sipRequest.setVia(via);
sipRequest.setHeader(maxForwards);
sipRequest.setContent(content, contentType);
return sipRequest;
| public Request | createRequest(java.lang.String requestString)Create a request from a string. Conveniance method for UACs
that want to create an outgoing request from a string. Only the
headers of the request should be included in the String that is
supplied to this method.
Request sipRequest = new Request();
StringMsgParser parser = new StringMsgParser();
SipURI requestURI = parser.parseSIPUrl(requestString);
sipRequest.setRequestURI(requestURI);
return sipRequest;
| public Request | createRequest(URI requestURI, java.lang.String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector 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.
if (requestURI == null ||
method == null ||
callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null ||
content == null ||
contentType == null) {
throw new NullPointerException("Null parameters");
}
Request sipRequest = new Request();
sipRequest.setRequestURI(requestURI);
sipRequest.setMethod(method);
sipRequest.setCallId(callId);
sipRequest.setHeader(cSeq);
sipRequest.setHeader(from);
sipRequest.setHeader(to);
sipRequest.setVia(via);
sipRequest.setHeader(maxForwards);
sipRequest.setContent(content, contentType);
return sipRequest;
| public Request | createRequest(URI requestURI, java.lang.String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector 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.
if (requestURI == null ||
method == null ||
callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null ||
content == null ||
contentType == null)
throw new ParseException("JAIN-SIP Exception,"
+ " some parameters are missing"
+ ", unable to create the request", 0);
Request sipRequest = new Request();
sipRequest.setRequestURI(requestURI);
sipRequest.setMethod(method);
sipRequest.setCallId(callId);
sipRequest.setHeader(cSeq);
sipRequest.setHeader(from);
sipRequest.setHeader(to);
sipRequest.setVia(via);
sipRequest.setHeader(maxForwards);
sipRequest.setHeader(contentType);
sipRequest.setMessageContent(content);
return sipRequest;
| public Request | createRequest(URI requestURI, java.lang.String method, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector 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.
This new Request does not contain a body.
if (requestURI == null ||
method == null ||
callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null)
throw new ParseException("JAIN-SIP Exception, "
+ "some parameters are missing"
+ ", unable to create the request", 0);
Request sipRequest = new Request();
sipRequest.setRequestURI(requestURI);
sipRequest.setMethod(method);
sipRequest.setCallId(callId);
sipRequest.setHeader(cSeq);
sipRequest.setHeader(from);
sipRequest.setHeader(to);
sipRequest.setVia(via);
sipRequest.setHeader(maxForwards);
return sipRequest;
| public Response | createResponse(int statusCode, Request request)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.
if (request == null)
throw new NullPointerException("null parameters");
// if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
// Logging.report(Logging.INFORMATION, LogChannels.LC_JSR180,
// "createResponse " + request);
// }
Request sipRequest = (Request)request;
Response sipResponse = sipRequest.createResponse(statusCode);
// Remove the content from the message
sipResponse.removeContent();
sipResponse.removeHeader(ContentTypeHeader.NAME);
return sipResponse;
| public Response | createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector 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.
if (callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null ||
content == null ||
contentType == null)
throw new NullPointerException("missing parameters");
Response sipResponse = new Response();
StatusLine statusLine = new StatusLine();
statusLine.setStatusCode(statusCode);
String reason = Response.getReasonPhrase(statusCode);
if (reason == null)
throw new ParseException(statusCode + " Unknown", 0);
statusLine.setReasonPhrase(reason);
sipResponse.setStatusLine(statusLine);
sipResponse.setCallId(callId);
sipResponse.setHeader(cSeq);
sipResponse.setHeader(from);
sipResponse.setHeader(to);
sipResponse.setVia(via);
sipResponse.setContent(content, contentType);
return sipResponse;
| public Response | createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector 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.
if (callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null ||
content == null ||
contentType == null)
throw new NullPointerException("missing parameters");
Response sipResponse = new Response();
StatusLine statusLine = new StatusLine();
statusLine.setStatusCode(statusCode);
String reason = Response.getReasonPhrase(statusCode);
if (reason == null)
throw new ParseException(statusCode + " : Unknown", 0);
statusLine.setReasonPhrase(reason);
sipResponse.setStatusLine(statusLine);
sipResponse.setCallId(callId);
sipResponse.setHeader(cSeq);
sipResponse.setHeader(from);
sipResponse.setHeader(to);
sipResponse.setVia(via);
sipResponse.setContent(content, contentType);
return sipResponse;
| public Response | createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector via, MaxForwardsHeader maxForwards, java.lang.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.
if (callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null ||
content == null ||
contentType == null)
throw new NullPointerException("unable to create the response");
Response sipResponse = new Response();
StatusLine statusLine = new StatusLine();
statusLine.setStatusCode(statusCode);
String reasonPhrase = Response.getReasonPhrase(statusCode);
if (reasonPhrase == null)
throw new ParseException(statusCode + " Unknown ", 0);
statusLine.setReasonPhrase(reasonPhrase);
sipResponse.setStatusLine(statusLine);
sipResponse.setCallId(callId);
sipResponse.setHeader(cSeq);
sipResponse.setHeader(from);
sipResponse.setHeader(to);
sipResponse.setVia(via);
sipResponse.setHeader(maxForwards);
sipResponse.setContent(content, contentType);
return sipResponse;
| public Response | createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector 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.
if (callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null ||
content == null ||
contentType == null)
throw new NullPointerException("Null params");
Response sipResponse = new Response();
sipResponse.setStatusCode(statusCode);
sipResponse.setCallId(callId);
sipResponse.setHeader(cSeq);
sipResponse.setHeader(from);
sipResponse.setHeader(to);
sipResponse.setVia(via);
sipResponse.setHeader(maxForwards);
sipResponse.setHeader(contentType);
sipResponse.setMessageContent(content);
return sipResponse;
| public Response | createResponse(int statusCode, CallIdHeader callId, CSeqHeader cSeq, FromHeader from, ToHeader to, java.util.Vector via, MaxForwardsHeader maxForwards)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.
if (callId == null ||
cSeq == null ||
from == null ||
to == null ||
via == null ||
maxForwards == null)
throw new ParseException("JAIN-SIP Exception, "
+ "some parameters are missing"
+ ", unable to create the response", 0);
Response sipResponse = new Response();
sipResponse.setStatusCode(statusCode);
sipResponse.setCallId(callId);
sipResponse.setHeader(cSeq);
sipResponse.setHeader(from);
sipResponse.setHeader(to);
sipResponse.setVia(via);
sipResponse.setHeader(maxForwards);
return sipResponse;
| public 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.
if (request == null ||
content == null ||
contentType == null)
throw new NullPointerException("null parameters");
Request sipRequest = (Request)request;
Response sipResponse = sipRequest.createResponse(statusCode);
sipResponse.setContent(content, contentType);
return sipResponse;
| public 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.
if (request == null ||
content == null ||
contentType == null)
throw new NullPointerException("null Parameters");
Request sipRequest = (Request)request;
Response sipResponse = sipRequest.createResponse(statusCode);
sipResponse.setHeader(contentType);
sipResponse.setMessageContent(content);
return sipResponse;
|
|