Home | History | Annotate | Download | only in sip
      1 package gov.nist.javax.sip;
      2 
      3 import javax.sip.ClientTransaction;
      4 import javax.sip.Dialog;
      5 import javax.sip.ResponseEvent;
      6 import javax.sip.message.Response;
      7 
      8 /**
      9  * Extension for ResponseEvent.
     10  *
     11  * @since v2.0
     12  */
     13 public class ResponseEventExt extends ResponseEvent {
     14     private ClientTransactionExt  m_originalTransaction;
     15     public ResponseEventExt(Object source, ClientTransactionExt clientTransaction,
     16             Dialog dialog,  Response response) {
     17         super(source,clientTransaction,dialog,response);
     18         m_originalTransaction = clientTransaction;
     19     }
     20 
     21     /**
     22      * Return true if this is a forked response.
     23      *
     24      * @return true if the response event is for a forked response.
     25      */
     26     public boolean isForkedResponse() {
     27         return super.getClientTransaction() == null && m_originalTransaction != null;
     28     }
     29 
     30     /**
     31      * Set the original transaction for a forked response.
     32      *
     33      * @param originalTransaction - the original transaction for which this response event is a fork.
     34      */
     35     public void setOriginalTransaction(ClientTransactionExt originalTransaction ) {
     36         m_originalTransaction = originalTransaction;
     37     }
     38 
     39     /**
     40      * Get the original transaction for which this is a forked response.
     41      * Note that this transaction can be in a TERMINATED state.
     42      *
     43      * @return the original clientTx for which this is a forked response.
     44      */
     45     public ClientTransactionExt getOriginalTransaction() {
     46         return this.m_originalTransaction;
     47     }
     48 
     49 
     50 }
     51