org.jboss.soa.esb.listeners.gateway
Class HttpGatewayListener

java.lang.Object
  extended by org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
      extended by org.jboss.soa.esb.listeners.gateway.HttpGatewayListener
All Implemented Interfaces:
java.io.Serializable, ManagedLifecycle

public class HttpGatewayListener
extends AbstractManagedLifecycle

Tomcat Listener provids the functionality to pass the http request to ESB service .

This class will generate Connector, StandardHost and StandardContext for user defined http port, host and context. These generated tomcat components will be attached to jboss embeded tomcat(aka jboss web). You can monitor and control these new generated components through jboss JMX console. When this listener is stoped, these components will be destoried automatically.

The different tomcat listner can be started in same port with different context.for example: http://localhost:8765/jbossesb/servicecategory/servicename

This class uses the HttpMessageComposer by default.

Author:
Jim Ma
See Also:
HttpMessageComposer, Torg.jboss.soa.esb.listeners.gateway.HttpDispatchServlet, Serialized Form

Field Summary
 java.lang.String address
          Http address value
static java.lang.String ALLOW_HTTP_METHOD
          Allow http method config attribute name
static java.lang.String AUTH_METHOD
          Auth method config attribute name
static java.lang.String DISPATCH_SERVLET_CLASS
          The tag used to read the dispatch servlet class name value from configuration
 java.lang.String host
          Http host value
 java.lang.String httpContext
          listener contenxt
 java.lang.String maxThreads
          Default max threads
 java.lang.String port
          Http port value
static java.lang.String REQUEST_CONTEXT_TAG
          The tag used to read the context value from configuration
static java.lang.String SECURITY_DOMAIN
          Security domain config attribute name
static java.lang.String SECURITY_ROLE
          Security role config attribute name
static java.lang.String SERVER_HOST_TAG
          The tag used to read the host value from configuration
static java.lang.String SERVER_PORT_TAG
          The tag used to read the port value from configuration
 
Fields inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
PARAM_TERMINATION_PERIOD
 
Constructor Summary
HttpGatewayListener(ConfigTree config)
          Constuct the TomcatGatewyListner
 
Method Summary
protected  UncomposedMessageDeliveryAdapter createDeliveryAdapter()
          Get the uncomposed message delivery dapater
protected  void doDestroy()
          Handle the destroy of the managed instance.
protected  void doInitialise()
          Handle the initialisation of the managed instance.
protected  void doStart()
          Handle the start of the managed instance.
protected  void doStop()
          Handle the stop of the managed instance.
protected  void initWebappDefaults(org.apache.catalina.core.StandardContext ctx)
          Initialize the StandardContext.By default it will uses org.jboss.soa.esb.listeners.gateway.TomcatDefaultServlet as default servlet mapping
protected  void startHttpServer()
          Start the tomcat http server.It will check if it really needs to create Tomcat connector and host.
 void stopHttpServer()
          Stop tomcat server.
 
Methods inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
addManagedLifecycleEventListener, changeState, destroy, getConfig, getState, getTerminationPeriod, initialise, removeManagedLifecycleEventListener, start, stop, waitUntilDestroyed, waitUntilDestroyed, waitUntilNotState, waitUntilState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_HOST_TAG

public static java.lang.String SERVER_HOST_TAG
The tag used to read the host value from configuration


SERVER_PORT_TAG

public static java.lang.String SERVER_PORT_TAG
The tag used to read the port value from configuration


REQUEST_CONTEXT_TAG

public static java.lang.String REQUEST_CONTEXT_TAG
The tag used to read the context value from configuration


DISPATCH_SERVLET_CLASS

public static java.lang.String DISPATCH_SERVLET_CLASS
The tag used to read the dispatch servlet class name value from configuration


ALLOW_HTTP_METHOD

public static final java.lang.String ALLOW_HTTP_METHOD
Allow http method config attribute name

See Also:
Constant Field Values

AUTH_METHOD

public static final java.lang.String AUTH_METHOD
Auth method config attribute name

See Also:
Constant Field Values

SECURITY_DOMAIN

public static final java.lang.String SECURITY_DOMAIN
Security domain config attribute name

See Also:
Constant Field Values

SECURITY_ROLE

public static final java.lang.String SECURITY_ROLE
Security role config attribute name

See Also:
Constant Field Values

host

public java.lang.String host
Http host value


address

public java.lang.String address
Http address value


port

public java.lang.String port
Http port value


maxThreads

public java.lang.String maxThreads
Default max threads


httpContext

public java.lang.String httpContext
listener contenxt

Constructor Detail

HttpGatewayListener

public HttpGatewayListener(ConfigTree config)
                    throws ConfigurationException
Constuct the TomcatGatewyListner

Parameters:
config - The listener configuration
Throws:
ConfigurationException - Exception during construction
Method Detail

doStart

protected void doStart()
                throws ManagedLifecycleException
Description copied from class: AbstractManagedLifecycle
Handle the start of the managed instance.

Specified by:
doStart in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while starting.

doStop

protected void doStop()
               throws ManagedLifecycleException
Description copied from class: AbstractManagedLifecycle
Handle the stop of the managed instance.

Specified by:
doStop in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while stopping.

doInitialise

protected void doInitialise()
                     throws ManagedLifecycleException
Description copied from class: AbstractManagedLifecycle
Handle the initialisation of the managed instance.

Specified by:
doInitialise in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while initialisation.

doDestroy

protected void doDestroy()
                  throws ManagedLifecycleException
Description copied from class: AbstractManagedLifecycle
Handle the destroy of the managed instance.

Specified by:
doDestroy in class AbstractManagedLifecycle
Throws:
ManagedLifecycleException - for errors while destroying.

startHttpServer

protected void startHttpServer()
                        throws java.lang.Exception
Start the tomcat http server.It will check if it really needs to create Tomcat connector and host. Then add these new tomcat component to tomcat Engine tree through JMX server.

Throws:
java.lang.Exception - For error during start tomcat context

stopHttpServer

public void stopHttpServer()
                    throws java.lang.Exception
Stop tomcat server. It will destroy the generated tomcat connector or host . Before do it , it will check if the reference count for it is zero .When there is no tomcat listener uses the generated host or connector, it will destroy it

Throws:
java.lang.Exception - For errors during stop tomcat connector or host

createDeliveryAdapter

protected UncomposedMessageDeliveryAdapter createDeliveryAdapter()
                                                          throws ConfigurationException
Get the uncomposed message delivery dapater

Returns:
uncomposed message delivery adapter
Throws:
ConfigurationException - For configuation error

initWebappDefaults

protected void initWebappDefaults(org.apache.catalina.core.StandardContext ctx)
                           throws java.lang.Exception
Initialize the StandardContext.By default it will uses org.jboss.soa.esb.listeners.gateway.TomcatDefaultServlet as default servlet mapping

Parameters:
ctx - Created tomcat standard context
Throws:
java.lang.Exception - For errors during initialization