Package org.cafesip.jiplet

Source Code of org.cafesip.jiplet.JipletResponse

/*
* Created on Nov 16, 2004
*
  * Copyright 2005 CafeSip.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.cafesip.jiplet;

import javax.sip.ResponseEvent;

import org.cafesip.jiplet.sip.SipCommunicator;

/**
* This class conatins methods that is used by a jiplet to retrieve information about a response event.
* When a SIP response message is received, the container passes on the event to the
* jiplet that sent the SIP request message. The callback method Jiplet.processResponse()
* is called by the container. This object is passed as a parameter.  
*
* @author Amit Chatterjee
*
*/
public class JipletResponse extends JipletEvent
{
    private ResponseEvent responseEvent;
    private JipletTransaction transaction;
    private Jiplet jiplet;
   
    /**
     *  A constructor for this class.
     *
     * 
     */
    protected JipletResponse()
    {       
    }   
   
    /**
     * @return Returns the responseEvent.
     */
    public ResponseEvent getResponseEvent()
    {
        return responseEvent;
    }
    /**
     * @param responseEvent The responseEvent to set.
     */
    protected void setResponseEvent(ResponseEvent responseEvent)
    {
        this.responseEvent = responseEvent;
    }

    /**
     * Get the session object associated with this response. A session identifies the SIP endpoint (UAC).
     * Session-scope variables are supported similar to servlets and this object is used for storing
     * session-scope variables.
     *
     * @param create
     *     create the session object if it does not exist.
     *
     * @return the session object. Null if the create parameter is false and the session object does not
     * exist.
     */   
    public JipletSession getSession(boolean create)
    {
        return super.getSession(responseEvent.getResponse(), create);
    }   
    /**
     * @return Returns the transaction.
     */
    public JipletTransaction getTransaction()
    {
        return transaction;
    }
    /**
     * @param transaction The transaction to set.
     */
    protected void setTransaction(JipletTransaction transaction)
    {
        this.transaction = transaction;
    }
    /**
     * @return Returns the jiplet.
     */
    public Jiplet getJiplet()
    {
        return jiplet;
    }
    /**
     * @param jiplet The jiplet to set.
     */
    protected void setJiplet(Jiplet jiplet)
    {
        this.jiplet = jiplet;
    }
   
    /**
     * This method returns a proxy object which can be used to proxy SIP requests, responses,
     * handle proxy timeouts and other SIP-related operations.
     * @return
     */
    public SipCommunicator getSipCommunicator()
    {
        return new SipCommunicator(jiplet, responseEvent);
    }
}
TOP

Related Classes of org.cafesip.jiplet.JipletResponse

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.