|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nist.core.GenericObject
gov.nist.javax.sip.message.MessageObject
gov.nist.javax.sip.message.SIPMessage
gov.nist.javax.sip.message.SIPRequest
public final class SIPRequest
The SIP Request structure.
Field Summary |
---|
Fields inherited from interface javax.sip.message.Request |
---|
ACK, BYE, CANCEL, INFO, INVITE, MESSAGE, NOTIFY, OPTIONS, PRACK, PUBLISH, REFER, REGISTER, SUBSCRIBE, UPDATE |
Constructor Summary | |
---|---|
SIPRequest()
Constructor. |
Method Summary | |
---|---|
void |
checkHeaders()
Check header for constraints. (1) Invite options and bye requests can only have SIP URIs in the contact headers. (2) Request must have cseq, to and from and via headers. (3) Method in request URI must match that in CSEQ. |
Object |
clone()
Make a clone (deep copy) of this object. |
SIPRequest |
createACKRequest()
Create an ACK request from this request. |
SIPRequest |
createAckRequest(To responseToHeader)
Creates a default ACK SIPRequest message for this original request. |
SIPRequest |
createBYERequest(boolean switchHeaders)
Create a BYE request from this request. |
SIPRequest |
createCancelRequest()
Creates a default SIPResquest message that would cancel this request. |
SIPRequest |
createErrorAck(To responseToHeader)
Creates an ACK for non-2xx responses according to RFC3261 17.1.1.3 |
SIPResponse |
createResponse(int statusCode)
Creates a default SIPResponse message for this request. |
SIPResponse |
createResponse(int statusCode,
String reasonPhrase)
Creates a default SIPResponse message for this request. |
SIPRequest |
createSIPRequest(RequestLine requestLine,
boolean switchHeaders)
Create a new default SIPRequest from the original request. |
String |
debugDump()
Convert to a formatted string for pretty printing. |
String |
encode()
Encode the SIP Request as a string. |
byte[] |
encodeAsBytes(String transport)
Encode this into a byte array. |
String |
encodeMessage()
Encode only the headers and not the content. |
boolean |
equals(Object other)
Compare for equality. |
static String |
getCannonicalName(String method)
Set to standard constants to speed up processing. this makes equals comparisons run much faster in the stack because then it is just identity comparision. |
String |
getDialogId(boolean isServer)
Get a dialog identifier. |
String |
getDialogId(boolean isServer,
String toTag)
Get a dialog id given the remote tag. |
String |
getFirstLine()
Get the first line encoded. |
Object |
getInviteTransaction()
|
String |
getMergeId()
Generates an Id for checking potentially merged requests. |
LinkedList |
getMessageAsEncodedStrings()
Get the message as a linked list of strings. |
Object |
getMessageChannel()
Book keeping method to get the messasge channel for the request. |
String |
getMethod()
Get the method from the request line. |
RequestLine |
getRequestLine()
Get the Request Line of the SIPRequest. |
URI |
getRequestURI()
A conveniance function to access the Request URI. |
String |
getSIPVersion()
Get the SIP version. |
Object |
getTransaction()
Book keeping method to return the current tx for the request if one exists. |
String |
getViaHost()
Get the host from the topmost via header. |
int |
getViaPort()
Get the port from the topmost via header. |
boolean |
isNullRequest()
Return true if this is a null request (i.e. does not have a request line ). |
static boolean |
isTargetRefresh(String ucaseMethod)
|
boolean |
match(Object matchObj)
Match with a template. |
void |
setInviteTransaction(Object inviteTransaction)
|
void |
setMessageChannel(Object messageChannel)
Set the message channel for the request ( bookkeeping field ). |
void |
setMethod(String method)
Set the method. |
void |
setNullRequest()
Set a flag to indiate this is a special message ( encoded with CRLFCRLF ). |
void |
setRequestLine(RequestLine requestLine)
Set the request line of the SIP Request. |
void |
setRequestURI(URI uri)
Sets the RequestURI of Request. |
void |
setSIPVersion(String sipVersion)
Set the sip version. |
void |
setTransaction(Object transaction)
Book keeping field to set the current tx for the request. |
String |
toString()
ALias for encode above. |
Methods inherited from class gov.nist.javax.sip.message.MessageObject |
---|
dbgPrint, dbgPrint |
Methods inherited from class gov.nist.core.GenericObject |
---|
debugDump, encode, getClassFromName, getMatcher, isMySubclass, makeClone, setMatcher |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.sip.message.Message |
---|
addFirst, addHeader, addLast, getContent, getContentDisposition, getContentEncoding, getContentLanguage, getContentLength, getExpires, getHeader, getHeaderNames, getHeaders, getRawContent, getUnrecognizedHeaders, hashCode, removeContent, removeFirst, removeHeader, removeLast, setContent, setContentDisposition, setContentEncoding, setContentLanguage, setContentLength, setExpires, setHeader |
Constructor Detail |
---|
public SIPRequest()
Method Detail |
---|
public static boolean isTargetRefresh(String ucaseMethod)
public static String getCannonicalName(String method)
public RequestLine getRequestLine()
public void setRequestLine(RequestLine requestLine)
requestLine
- is the request line to set in the SIP Request.public String debugDump()
debugDump
in class SIPMessage
public void checkHeaders() throws ParseException
ParseException
public URI getRequestURI()
getRequestURI
in interface Request
public void setRequestURI(URI uri)
setRequestURI
in interface Request
uri
- the new Request URI of this request messagepublic void setMethod(String method)
setMethod
in interface Request
method
- is the method to set.
IllegalArgumentException
- if the method is nullpublic String getMethod()
getMethod
in interface Request
public String encode()
encode
in class SIPMessage
public String encodeMessage()
encodeMessage
in class SIPMessage
public String toString()
toString
in interface Message
toString
in class SIPMessage
public Object clone()
clone
in interface Message
clone
in class SIPMessage
public boolean equals(Object other)
equals
in interface Message
equals
in class SIPMessage
other
- object to compare ourselves with.
public LinkedList getMessageAsEncodedStrings()
getMessageAsEncodedStrings
in class SIPMessage
public boolean match(Object matchObj)
match
in class SIPMessage
matchObj
- object to match ourselves with (null matches wildcard)
public String getDialogId(boolean isServer)
getDialogId
in class SIPMessage
isServer
- is set to true if this is the UAS and set to false if this is the UACpublic String getDialogId(boolean isServer, String toTag)
public byte[] encodeAsBytes(String transport)
encodeAsBytes
in class SIPMessage
public SIPResponse createResponse(int statusCode)
statusCode
- Status code for the response. Reason phrase is generated.
public SIPResponse createResponse(int statusCode, String reasonPhrase)
statusCode
- Status code for the response.reasonPhrase
- Reason phrase for this response.
public SIPRequest createCancelRequest() throws SipException
SipException
ParseException
public SIPRequest createAckRequest(To responseToHeader)
responseToHeader
- To header to use for this request.
public final SIPRequest createErrorAck(To responseToHeader) throws SipException, ParseException
SipException
NullPointerException
ParseException
public SIPRequest createSIPRequest(RequestLine requestLine, boolean switchHeaders)
requestLine
- is the new request line.switchHeaders
- is a boolean flag that causes to and from headers to switch (set this
to true if you are the server of the transaction and are generating a BYE request).
If the headers are switched, we generate new From and To headers otherwise we just
use the incoming headers.
public SIPRequest createBYERequest(boolean switchHeaders)
switchHeaders
- is a boolean flag that causes from and isServerTransaction to headers
to be swapped. Set this to true if you are the server of the dialog and are
generating a BYE request for the dialog.
public SIPRequest createACKRequest()
public String getViaHost()
public int getViaPort()
public String getFirstLine()
getFirstLine
in class SIPMessage
public void setSIPVersion(String sipVersion) throws ParseException
setSIPVersion
in interface Message
setSIPVersion
in class SIPMessage
sipVersion
- the sip version to set.
ParseException
- which signals that an error has been reached
unexpectedly while parsing the version argument.public String getSIPVersion()
getSIPVersion
in interface Message
getSIPVersion
in class SIPMessage
public Object getTransaction()
public void setTransaction(Object transaction)
transaction
- public Object getMessageChannel()
public void setMessageChannel(Object messageChannel)
messageChannel
- public String getMergeId()
public void setInviteTransaction(Object inviteTransaction)
inviteTransaction
- the inviteTransaction to setpublic Object getInviteTransaction()
public boolean isNullRequest()
public void setNullRequest()
|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |