org.mule.transport.servlet.jetty
Class JettyHttpConnector

java.lang.Object
  extended by org.mule.transport.AbstractConnector
      extended by org.mule.transport.servlet.jetty.JettyHttpConnector
All Implemented Interfaces:
EventListener, javax.resource.spi.work.WorkListener, Disposable, Initialisable, Lifecycle, LifecycleStateEnabled, Startable, Stoppable, NameableObject, NamedObject, Connectable, Connector
Direct Known Subclasses:
JettyHttpsConnector

public class JettyHttpConnector
extends AbstractConnector

The JettyConnector can be using to embed a Jetty server to receive requests on an http inbound endpoint. One server is created for each connector declared, many Jetty endpoints can share the same connector.


Nested Class Summary
 class JettyHttpConnector.MuleReceiverConnectorHolder
           
 
Field Summary
protected  HashMap<String,ConnectorHolder> holders
           
static String JETTY
           
static String MULE_CONTEXT_ATTRIBUTE
           
static String ROOT
           
 
Fields inherited from class org.mule.transport.AbstractConnector
createMultipleTransactedReceivers, DEFAULT_NUM_CONCURRENT_TX_RECEIVERS, dispatcherFactory, dispatcherPoolFactory, dispatchers, initialStateStopped, lifecycleManager, logger, muleContext, muleMessageFactory, name, numberOfConcurrentTransactedReceivers, PROPERTY_POLLING_FREQUENCY, receivers, requesterFactory, requesters, serviceDescriptor, serviceOverrides, sessionHandler, startOnConnect
 
Fields inherited from interface org.mule.api.transport.Connector
INT_VALUE_NOT_SET
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
JettyHttpConnector(MuleContext context)
           
 
Method Summary
protected  void addHandler(org.eclipse.jetty.server.Handler handler)
           
 boolean canHostFullWars()
          A helper method to differentiate between jetty-based connectors which can host full wars and ones which can't.
protected  ConnectorHolder createContextHolder(org.eclipse.jetty.server.Connector connector, InboundEndpoint endpoint, MessageReceiver receiver)
           
protected  org.eclipse.jetty.server.AbstractConnector createJettyConnector()
           
protected  MessageReceiver createReceiver(FlowConstruct flowConstruct, InboundEndpoint endpoint)
          Create a Message receiver for this connector
protected  Servlet createServlet(org.eclipse.jetty.server.Connector connector, ImmutableEndpoint endpoint)
           
protected  void doConnect()
          Template method where any connections should be made for the connector
protected  void doDisconnect()
          Template method where any connected resources used by the connector should be disconnected
protected  void doDispose()
          Template method to dispose any resources associated with this receiver.
protected  void doInitialise()
           
protected  void doStart()
          Template method to perform any work when starting the connectoe
protected  void doStop()
          Template method to perform any work when stopping the connectoe
 int getAcceptors()
          Get the number of "acceptor" threads Jetty should use
 String getConfigFile()
           
protected  String getHolderKey(ImmutableEndpoint endpoint)
           
 org.eclipse.jetty.server.Server getHttpServer()
           
 String getProtocol()
           
 JettyReceiverServlet getReceiverServlet()
           
 ReplyToHandler getReplyToHandler(ImmutableEndpoint endpoint)
          Getter for property 'replyToHandler'.
 String getResourceBase()
           
 WebappsConfiguration getWebappsConfiguration()
           
protected  void initialiseFromConfigFile()
           
 boolean isUseContinuations()
           
 void setAcceptors(int acceptors)
          Set the number of "acceptor" threads Jetty should use
 void setConfigFile(String configFile)
           
 void setReceiverServlet(JettyReceiverServlet receiverServlet)
           
 void setResourceBase(String resourceBase)
           
protected  void setupJettyLogging()
           
 void setUseContinuations(boolean useContinuations)
           
 void setWebappsConfiguration(WebappsConfiguration webappsConfiguration)
           
 void unregisterListener(MessageReceiver receiver)
           
 
Methods inherited from class org.mule.transport.AbstractConnector
clearDispatchers, clearRequesters, configureDispatcherPool, connect, createDefaultRedeliveryPolicy, createDispatcherMessageProcessor, createMuleMessageFactory, createOperationResource, createScheduler, destroyReceiver, disconnect, dispose, disposeReceivers, disposeWorkManagers, doUnregisterListener, fireNotification, getConnectEventId, getConnectionDescription, getDefaultExchangePattern, getDefaultInboundTransformers, getDefaultOutboundTransformers, getDefaultResponseTransformers, getDispatcherFactory, getDispatcherPoolFactory, getDispatcherThreadingProfile, getDispatcherWorkManager, getInboundExchangePatterns, getLifecycleState, getMaxDispatchersActive, getMaxRequestersActive, getMaxTotalDispatchers, getMuleContext, getMuleMessageFactory, getName, getNumberOfConcurrentTransactedReceivers, getOperationResourceFactory, getOutboundExchangePatterns, getOutputStream, getReceiver, getReceiverKey, getReceivers, getReceivers, getReceiverThreadingProfile, getReceiverWorkManager, getRequesterFactory, getRequesterThreadingProfile, getRequesterWorkManager, getRetryPolicyTemplate, getScheduler, getServiceDescriptor, getServiceOverrides, getSessionHandler, getSupportedProtocols, getTransactionalResource, handleWorkException, initFromServiceDescriptor, initialise, initialiseFromUrl, initWorkManagers, isConnected, isConnecting, isCreateMultipleTransactedReceivers, isDisposed, isEnableMessageEvents, isInitialised, isInitialStateStopped, isResponseEnabled, isStarted, isStarting, isStopped, isStopping, isValidateConnections, lookupReceiver, registerListener, registerSupportedMetaProtocol, registerSupportedProtocol, registerSupportedProtocolWithoutPrefix, request, request, setConnected, setConnecting, setCreateMultipleTransactedReceivers, setDispatcherFactory, setDispatcherPoolFactory, setDispatcherPoolMaxWait, setDispatcherPoolWhenExhaustedAction, setDispatcherThreadingProfile, setDynamicNotification, setInitialStateStopped, setMaxDispatchersActive, setMaxRequestersActive, setName, setNumberOfConcurrentTransactedReceivers, setReceiverThreadingProfile, setRequesterFactory, setRequesterPoolMaxWait, setRequesterPoolWhenExhaustedAction, setRequesterThreadingProfile, setRetryPolicyTemplate, setServiceOverrides, setSessionHandler, setSupportedProtocols, setupDispatchReturn, setupRequestReturn, setValidateConnections, shutdownScheduler, start, startAfterConnect, stop, supportsProtocol, toString, unregisterListener, unregisterSupportedProtocol, updateCachedNotificationHandler, validateConnection, workAccepted, workCompleted, workRejected, workStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ROOT

public static final String ROOT
See Also:
Constant Field Values

JETTY

public static final String JETTY
See Also:
Constant Field Values

MULE_CONTEXT_ATTRIBUTE

public static final String MULE_CONTEXT_ATTRIBUTE
See Also:
Constant Field Values

holders

protected HashMap<String,ConnectorHolder> holders
Constructor Detail

JettyHttpConnector

public JettyHttpConnector(MuleContext context)
Method Detail

setupJettyLogging

protected void setupJettyLogging()

getProtocol

public String getProtocol()
Returns:
the primary protocol name for endpoints of this connector

doInitialise

protected void doInitialise()
                     throws InitialisationException
Specified by:
doInitialise in class AbstractConnector
Throws:
InitialisationException

addHandler

protected void addHandler(org.eclipse.jetty.server.Handler handler)

initialiseFromConfigFile

protected void initialiseFromConfigFile()
                                 throws InitialisationException
Throws:
InitialisationException

doDispose

protected void doDispose()
Template method to dispose any resources associated with this receiver. There is not need to dispose the connector as this is already done by the framework

Specified by:
doDispose in class AbstractConnector

doStart

protected void doStart()
                throws MuleException
Description copied from class: AbstractConnector
Template method to perform any work when starting the connectoe

Specified by:
doStart in class AbstractConnector
Throws:
MuleException - if the method fails

doStop

protected void doStop()
               throws MuleException
Description copied from class: AbstractConnector
Template method to perform any work when stopping the connectoe

Specified by:
doStop in class AbstractConnector
Throws:
MuleException - if the method fails

doConnect

protected void doConnect()
                  throws Exception
Template method where any connections should be made for the connector

Specified by:
doConnect in class AbstractConnector
Throws:
Exception

doDisconnect

protected void doDisconnect()
                     throws Exception
Template method where any connected resources used by the connector should be disconnected

Specified by:
doDisconnect in class AbstractConnector
Throws:
Exception

createReceiver

protected MessageReceiver createReceiver(FlowConstruct flowConstruct,
                                         InboundEndpoint endpoint)
                                  throws Exception
Description copied from class: AbstractConnector
Create a Message receiver for this connector

Overrides:
createReceiver in class AbstractConnector
Parameters:
flowConstruct - the service that will receive events from this receiver, the listener
endpoint - the endpoint that defies this inbound communication
Returns:
an instance of the message receiver defined in this connectors' TransportServiceDescriptor initialised using the service and endpoint.
Throws:
Exception - if there is a problem creating the receiver. This exception really depends on the underlying transport, thus any exception could be thrown

createJettyConnector

protected org.eclipse.jetty.server.AbstractConnector createJettyConnector()

unregisterListener

public void unregisterListener(MessageReceiver receiver)
                        throws MuleException
Throws:
MuleException

getHttpServer

public org.eclipse.jetty.server.Server getHttpServer()

getConfigFile

public String getConfigFile()

setConfigFile

public void setConfigFile(String configFile)

getReceiverServlet

public JettyReceiverServlet getReceiverServlet()

setReceiverServlet

public void setReceiverServlet(JettyReceiverServlet receiverServlet)

getReplyToHandler

public ReplyToHandler getReplyToHandler(ImmutableEndpoint endpoint)
Description copied from class: AbstractConnector
Getter for property 'replyToHandler'.

Overrides:
getReplyToHandler in class AbstractConnector
Returns:
Value for property 'replyToHandler'.

isUseContinuations

public boolean isUseContinuations()

setUseContinuations

public void setUseContinuations(boolean useContinuations)

getAcceptors

public int getAcceptors()
Get the number of "acceptor" threads Jetty should use

Returns:
the number of threads

setAcceptors

public void setAcceptors(int acceptors)
Set the number of "acceptor" threads Jetty should use

Parameters:
acceptors - the number of threads

createContextHolder

protected ConnectorHolder createContextHolder(org.eclipse.jetty.server.Connector connector,
                                              InboundEndpoint endpoint,
                                              MessageReceiver receiver)

createServlet

protected Servlet createServlet(org.eclipse.jetty.server.Connector connector,
                                ImmutableEndpoint endpoint)

getHolderKey

protected String getHolderKey(ImmutableEndpoint endpoint)

getResourceBase

public String getResourceBase()

setResourceBase

public void setResourceBase(String resourceBase)

getWebappsConfiguration

public WebappsConfiguration getWebappsConfiguration()

setWebappsConfiguration

public void setWebappsConfiguration(WebappsConfiguration webappsConfiguration)

canHostFullWars

public boolean canHostFullWars()
A helper method to differentiate between jetty-based connectors which can host full wars and ones which can't.



Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.