org.mobicents.servlet.sip.core.dispatchers
Class MessageDispatcher

java.lang.Object
  extended by org.mobicents.servlet.sip.core.dispatchers.MessageDispatcher
Direct Known Subclasses:
RequestDispatcher, ResponseDispatcher

public abstract class MessageDispatcher
extends java.lang.Object

Author:
Jean Deruelle

Field Summary
static java.lang.String APP_ID
           
static java.lang.String APP_NOT_DEPLOYED
           
static java.lang.String GENERATED_APP_KEY
           
static java.lang.String MODIFIER
           
static java.lang.String NO_APP_RETURNED
           
static java.lang.String ROUTE_PARAM_DIRECTIVE
           
static java.lang.String ROUTE_PARAM_NODE_HOST
           
static java.lang.String ROUTE_PARAM_NODE_PORT
           
static java.lang.String ROUTE_PARAM_PREV_APP_ID
           
static java.lang.String ROUTE_PARAM_PREV_APPLICATION_NAME
           
static java.lang.String RR_PARAM_APPLICATION_NAME
           
static java.lang.String RR_PARAM_PROXY_APP
           
protected  SipApplicationDispatcher sipApplicationDispatcher
           
 
Constructor Summary
MessageDispatcher(SipApplicationDispatcher sipApplicationDispatcher)
           
 
Method Summary
static void callServlet(SipServletRequestImpl request)
           
static void callServlet(SipServletResponseImpl response)
           
abstract  void dispatchMessage(javax.sip.SipProvider sipProvider, SipServletMessageImpl sipServletMessage)
          Responsible for routing and dispatching a SIP message to the correct application
 java.util.concurrent.ExecutorService getConcurrencyModelExecutorService(SipContext sipContext, SipServletMessageImpl sipServletMessage)
          This method return an ExecutorService depending on the current concurrency strategy.
protected static SipApplicationSessionKey makeAppSessionKey(SipContext sipContext, SipServletRequestImpl sipServletRequestImpl, java.lang.String applicationName)
           
static boolean securityCheck(SipServletRequestImpl request)
           
static void sendErrorResponse(int errorCode, javax.sip.ServerTransaction transaction, javax.sip.message.Request request, javax.sip.SipProvider sipProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUTE_PARAM_DIRECTIVE

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

ROUTE_PARAM_PREV_APPLICATION_NAME

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

ROUTE_PARAM_PREV_APP_ID

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

RR_PARAM_APPLICATION_NAME

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

RR_PARAM_PROXY_APP

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

GENERATED_APP_KEY

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

APP_ID

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

APP_NOT_DEPLOYED

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

NO_APP_RETURNED

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

MODIFIER

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

ROUTE_PARAM_NODE_HOST

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

ROUTE_PARAM_NODE_PORT

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

sipApplicationDispatcher

protected SipApplicationDispatcher sipApplicationDispatcher
Constructor Detail

MessageDispatcher

public MessageDispatcher(SipApplicationDispatcher sipApplicationDispatcher)
Method Detail

sendErrorResponse

public static void sendErrorResponse(int errorCode,
                                     javax.sip.ServerTransaction transaction,
                                     javax.sip.message.Request request,
                                     javax.sip.SipProvider sipProvider)
Parameters:
errorCode -
transaction -
request -
sipProvider -

makeAppSessionKey

protected static SipApplicationSessionKey makeAppSessionKey(SipContext sipContext,
                                                            SipServletRequestImpl sipServletRequestImpl,
                                                            java.lang.String applicationName)
                                                     throws DispatcherException
Throws:
DispatcherException

callServlet

public static void callServlet(SipServletRequestImpl request)
                        throws javax.servlet.ServletException,
                               java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

callServlet

public static void callServlet(SipServletResponseImpl response)
                        throws javax.servlet.ServletException,
                               java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

securityCheck

public static boolean securityCheck(SipServletRequestImpl request)

dispatchMessage

public abstract void dispatchMessage(javax.sip.SipProvider sipProvider,
                                     SipServletMessageImpl sipServletMessage)
                              throws DispatcherException
Responsible for routing and dispatching a SIP message to the correct application

Parameters:
sipProvider - use the sipProvider to route the message if needed, can be null
sipServletMessage - the SIP message to route and dispatch
Throws:
java.lang.Exception - if anything wrong happens
DispatcherException

getConcurrencyModelExecutorService

public final java.util.concurrent.ExecutorService getConcurrencyModelExecutorService(SipContext sipContext,
                                                                                     SipServletMessageImpl sipServletMessage)
This method return an ExecutorService depending on the current concurrency strategy. It can return the executor of a sip session, app session or just threadpool executor which doesn't limit concurrent processing of requests per app or sip session. Since 0.8.1 it always return threadpool executor which doesn't limit concurrent processing since concurrency is achieved through semaphore

Parameters:
sipServletMessage - the request you put here must have app and sip session associated
Returns:


Copyright © 2009. All Rights Reserved.