org.echarts.servlet.sip.features.proxyRequest
Class ProxyRequestServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.sip.SipServlet
          extended by org.echarts.servlet.sip.EChartsProxyServlet
              extended by org.echarts.servlet.sip.features.proxyRequest.ProxyRequestServlet
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.servlet.Servlet, javax.servlet.ServletConfig, SipApplicationSessionListener

public class ProxyRequestServlet
extends EChartsProxyServlet
implements SipApplicationSessionListener

Servlet to conditionally proxy a request. This servlet subsumes the functionality of CCFServlet (conditional call forwarding) and UCFServlet (unconditional call failure). When a request is received, the servlet calls the getProxyRequestResponse() method of its ProxyRequestServletToJava interface implementation. If the method returns null then the request is forwarded unchanged. If the method returns an integer failure status code, then the associated failure response is returned to the caller. If the method returns a URI, then the request is forwarded to that URI. This feature is intended to be used as a non-record-route proxy and therefore does not include facilities for overriding the container's default strategy for session invalidation.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.echarts.servlet.sip.EChartsProxyServlet
isRecordRoute, isSupervised, monitor
 
Fields inherited from class javax.servlet.sip.SipServlet
OUTBOUND_INTERFACES, PRACK_SUPPORTED, SIP_FACTORY, SIP_SESSIONS_UTIL, SUPPORTED, SUPPORTED_RFCs, TIMER_SERVICE
 
Constructor Summary
ProxyRequestServlet()
           
 
Method Summary
protected  boolean handleInitialRequest(SipServletRequest req)
          Override handleInitialRequest to customize handling of initial requests.
 void init(javax.servlet.ServletConfig config)
          Initialize the servlet and monitor.
 void sessionCreated(SipApplicationSessionEvent ev)
          For SipApplicationSessionListener interface.
 void sessionDestroyed(SipApplicationSessionEvent ev)
          For SipApplicationSessionListener interface.
 void sessionExpired(SipApplicationSessionEvent sase)
          For SipApplicationSessionListener interface.
 void sessionReadyToInvalidate(SipApplicationSessionEvent ev)
          For SipApplicationSessionListener interface.
protected  URI specifyRequestURI(SipServletRequest request)
          Returns SipURI value returned by call to getProxyRequestResponse() by handleInitialRequest().
 
Methods inherited from class org.echarts.servlet.sip.EChartsProxyServlet
destroy, doRequest, doResponse, getBooleanInitParameter, getMonitor, getServletProperties, modifyRequest, modifyResponse, sendResponse
 
Methods inherited from class javax.servlet.sip.SipServlet
doAck, doBranchResponse, doBye, doCancel, doErrorResponse, doInfo, doInvite, doMessage, doNotify, doOptions, doPrack, doProvisionalResponse, doPublish, doRedirectResponse, doRefer, doRegister, doSubscribe, doSuccessResponse, doUpdate, log, log, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyRequestServlet

public ProxyRequestServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Description copied from class: EChartsProxyServlet
Initialize the servlet and monitor.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class EChartsProxyServlet
Throws:
javax.servlet.ServletException

handleInitialRequest

protected boolean handleInitialRequest(SipServletRequest req)
                                throws javax.servlet.ServletException,
                                       java.io.IOException
Description copied from class: EChartsProxyServlet
Override handleInitialRequest to customize handling of initial requests. If this methods returns true, it signifies that the request handling is complete, and the calling method doRequest returns immediately.

This allows the subclass to perform alternative action in handleInitialRequest, for example to act as UAS and send a final response, or set a timer to handle the request later.

Overrides:
handleInitialRequest in class EChartsProxyServlet
Parameters:
req - initial request
Returns:
Whether request handling is completed
Throws:
javax.servlet.ServletException
java.io.IOException

specifyRequestURI

protected URI specifyRequestURI(SipServletRequest request)
Returns SipURI value returned by call to getProxyRequestResponse() by handleInitialRequest().

Overrides:
specifyRequestURI in class EChartsProxyServlet
Parameters:
request - initial request
Returns:
desired Request-URI, or null for no change

sessionCreated

public void sessionCreated(SipApplicationSessionEvent ev)
For SipApplicationSessionListener interface.

Specified by:
sessionCreated in interface SipApplicationSessionListener

sessionDestroyed

public void sessionDestroyed(SipApplicationSessionEvent ev)
For SipApplicationSessionListener interface.

Specified by:
sessionDestroyed in interface SipApplicationSessionListener

sessionExpired

public final void sessionExpired(SipApplicationSessionEvent sase)
For SipApplicationSessionListener interface. This is required as a work-around for SailFin bug. This method is enabled by setting the javaee:listener-class tag value in sip.xml, otherwise it will be ignored.

Specified by:
sessionExpired in interface SipApplicationSessionListener

sessionReadyToInvalidate

public void sessionReadyToInvalidate(SipApplicationSessionEvent ev)
For SipApplicationSessionListener interface.

Specified by:
sessionReadyToInvalidate in interface SipApplicationSessionListener