org.cafesip.sipunit
Class SipRequest

java.lang.Object
  extended by org.cafesip.sipunit.SipMessage
      extended by org.cafesip.sipunit.SipRequest

public class SipRequest
extends SipMessage

The SipRequest class provides high level getter methods for a request received from the network. It is primarily used for SipTestCase assertions dealing with SIP message body and headers. The test program passes this object to these assert methods. The test program can obtain this object by calling the getLastReceivedRequest() or getAllReceivedRequests() on the MessageListener object (such as SipCall or Subscription) when using the high-level API or it can create this object using the RequestEvent/request object returned by a waitXyz() method (such as SipSession.waitRequest()) when using the low-level SipUnit API. A test program may call this object's getMessage() method to get the underlying javax.sip.message.Message object or call getRequestEvent() to get the associated javax.sip.RequestEvent which provides access to related JAIN-SIP objects such ServerTransaction, Dialog, etc. Knowledge of JAIN SIP API is required at this level.


Field Summary
static java.lang.String ACK
           
static java.lang.String BYE
           
static java.lang.String CANCEL
           
static java.lang.String INFO
           
static java.lang.String INVITE
          Request methods **********
static java.lang.String MESSAGE
           
static java.lang.String NOTIFY
           
static java.lang.String OPTIONS
           
static java.lang.String PRACK
           
static java.lang.String REFER
           
static java.lang.String REGISTER
           
static java.lang.String SUBSCRIBE
           
static java.lang.String UPDATE
           
 
Constructor Summary
SipRequest(javax.sip.message.Request request)
          A constructor for this class, applicable when using the low-level SipUnit API.
SipRequest(javax.sip.RequestEvent event)
          A constructor for this class used by SipUnit classes such as SipCall and Subscription to save the request event information so that the test program can get JAIN-SIP objects from it, if needed - ServerTransaction, Dialog, etc.
 
Method Summary
 javax.sip.RequestEvent getRequestEvent()
          Use this method if you need the JAIN-SIP request event associated with a request received by high level SipUnit classes like SipCall and Subscription.
 java.lang.String getRequestURI()
          Returns the request URI line of the request message or an empty string if there isn't one.
 boolean isAck()
          Indicates if the request method is ACK or not.
 boolean isBye()
          Indicates if the request method is BYE or not.
 boolean isInvite()
          Indicates if the request method is INVITE or not.
 boolean isNotify()
          Indicates if the request method is NOTIFY or not.
 boolean isSipURI()
          Indicates if the request URI in the request message is a URI with a scheme of "sip" or "sips".
 boolean isSubscribe()
          Indicates if the request method is SUBSCRIBE or not.
 void setRequestEvent(javax.sip.RequestEvent requestEvent)
          A setter for the request event.
 
Methods inherited from class org.cafesip.sipunit.SipMessage
getContent, getContentLength, getExpiry, getMessage, getRawContent, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INVITE

public static final java.lang.String INVITE
Request methods **********

See Also:
Constant Field Values

ACK

public static final java.lang.String ACK
See Also:
Constant Field Values

BYE

public static final java.lang.String BYE
See Also:
Constant Field Values

CANCEL

public static final java.lang.String CANCEL
See Also:
Constant Field Values

INFO

public static final java.lang.String INFO
See Also:
Constant Field Values

MESSAGE

public static final java.lang.String MESSAGE
See Also:
Constant Field Values

NOTIFY

public static final java.lang.String NOTIFY
See Also:
Constant Field Values

OPTIONS

public static final java.lang.String OPTIONS
See Also:
Constant Field Values

PRACK

public static final java.lang.String PRACK
See Also:
Constant Field Values

REFER

public static final java.lang.String REFER
See Also:
Constant Field Values

REGISTER

public static final java.lang.String REGISTER
See Also:
Constant Field Values

SUBSCRIBE

public static final java.lang.String SUBSCRIBE
See Also:
Constant Field Values

UPDATE

public static final java.lang.String UPDATE
See Also:
Constant Field Values
Constructor Detail

SipRequest

public SipRequest(javax.sip.message.Request request)
A constructor for this class, applicable when using the low-level SipUnit API. Call this method to create a SipRequest object after calling SipSession.waitRequest(), so that you can use the SipTestCase assert methods pertaining to SIP message body and headers (by passing in this object).

Parameters:
request - the Request contained within the RequestEvent object returned by SipSession.waitRequest()

SipRequest

public SipRequest(javax.sip.RequestEvent event)
A constructor for this class used by SipUnit classes such as SipCall and Subscription to save the request event information so that the test program can get JAIN-SIP objects from it, if needed - ServerTransaction, Dialog, etc. This constructor may also be used by a test program in lieu of the other constructor.

Parameters:
event -
Method Detail

getRequestURI

public java.lang.String getRequestURI()
Returns the request URI line of the request message or an empty string if there isn't one. The request URI indicates the user or service to which this request is addressed.

Returns:
the Request URI line as a string or "" if there isn't one

isSipURI

public boolean isSipURI()
Indicates if the request URI in the request message is a URI with a scheme of "sip" or "sips".

Returns:
true if the request URI scheme is "sip" or "sips", false otherwise.

isInvite

public boolean isInvite()
Indicates if the request method is INVITE or not.

Returns:
true if the method is INVITE, false otherwise.

isAck

public boolean isAck()
Indicates if the request method is ACK or not.

Returns:
true if the method is ACK, false otherwise.

isBye

public boolean isBye()
Indicates if the request method is BYE or not.

Returns:
true if the method is BYE, false otherwise.

isNotify

public boolean isNotify()
Indicates if the request method is NOTIFY or not.

Returns:
true if the method is NOTIFY, false otherwise.

isSubscribe

public boolean isSubscribe()
Indicates if the request method is SUBSCRIBE or not.

Returns:
true if the method is SUBSCRIBE, false otherwise.

getRequestEvent

public javax.sip.RequestEvent getRequestEvent()
Use this method if you need the JAIN-SIP request event associated with a request received by high level SipUnit classes like SipCall and Subscription.

Returns:
Returns the requestEvent.

setRequestEvent

public void setRequestEvent(javax.sip.RequestEvent requestEvent)
A setter for the request event.

Parameters:
requestEvent - The requestEvent to set.


http://www.cafesip.org