Package com.adaptris.core.http.jetty
Class HttpConnection
- java.lang.Object
-
- com.adaptris.core.AdaptrisConnectionImp
-
- com.adaptris.core.http.jetty.JettyConnection
-
- com.adaptris.core.http.jetty.HttpConnection
-
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,JettyServletRegistrar,StateManagedComponent
- Direct Known Subclasses:
HttpsConnection
@ComponentProfile(summary="Connection that creates its own jetty engine instance and listens on the specified port", tag="connections,http,jetty") public class HttpConnection extends JettyConnectionConcrete implementation of JettyConnection that allows HTTP traffic.By default all fields are left as null. This will cause Jetty to use its internal defaults. Consult the Jetty Documentation for information on the behaviour and configuration required.
The key from the
server-connector-propertieselement should match the name of the underlyingServerConnectorsetter.
will invoke<server-connector-properties> <key-value-pair> <key>ReuseAddress</key> <value>true</value> </key-value-pair> </server-connector-properties>ServerConnector#setReuseAddress(boolean), setting the ReuseAddress property to true. Note that no validation of the various properties is performed and will be passed as-is to theAbstractConnectorwith an attempt to transform into the correct type. Invalid combinations may result in undefined behaviour. Similarly additionalHttpConfigurationproperties can be configured via thehttp-connectionelement.In the adapter configuration file this class is aliased as jetty-http-connection which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpConnection.HttpConfigurationPropertyStandardHttpConfigurationproperties for use withsetHttpConfiguration(KeyValuePairSet).static classHttpConnection.ServerConnectorPropertyStandardServerConnectorproperties for use withsetServerConnectorProperties(KeyValuePairSet).
-
Field Summary
-
Fields inherited from class com.adaptris.core.http.jetty.JettyConnection
context, server
-
Fields inherited from class com.adaptris.core.AdaptrisConnectionImp
log
-
-
Constructor Summary
Constructors Constructor Description HttpConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.jetty.server.ServerConnectorconfigure(org.eclipse.jetty.server.ServerConnector connector)protected org.eclipse.jetty.server.HttpConfigurationcreateConfig()protected org.eclipse.jetty.server.ConnectionFactory[]createConnectionFactory()KeyValuePairSetgetHttpConfiguration()intgetPort()Get the port to listen on for HTTP traffic.SecurityHandlerWrappergetSecurityHandler()KeyValuePairSetgetServerConnectorProperties()protected voidprepareConnection()voidsetHttpConfiguration(KeyValuePairSet kvps)voidsetPort(int i)Set the port to listen on.voidsetSecurityHandler(SecurityHandlerWrapper s)Specify the SecurityHandler implementation.voidsetServerConnectorProperties(KeyValuePairSet httpProperties)-
Methods inherited from class com.adaptris.core.http.jetty.JettyConnection
addServlet, asArray, closeConnection, initConnection, removeServlet, startConnection, stopConnection
-
Methods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
-
-
-
Method Detail
-
createConnectionFactory
protected org.eclipse.jetty.server.ConnectionFactory[] createConnectionFactory() throws java.lang.Exception- Throws:
java.lang.Exception
-
createConfig
protected org.eclipse.jetty.server.HttpConfiguration createConfig() throws java.lang.Exception- Throws:
java.lang.Exception
-
configure
protected org.eclipse.jetty.server.ServerConnector configure(org.eclipse.jetty.server.ServerConnector connector) throws java.lang.Exception- Throws:
java.lang.Exception
-
setPort
public void setPort(int i)
Set the port to listen on.- Parameters:
i- the port, by default it is 8080
-
getPort
public int getPort()
Get the port to listen on for HTTP traffic.- Returns:
- the port
-
getServerConnectorProperties
public KeyValuePairSet getServerConnectorProperties()
-
setServerConnectorProperties
public void setServerConnectorProperties(KeyValuePairSet httpProperties)
-
getSecurityHandler
public SecurityHandlerWrapper getSecurityHandler()
- Returns:
- the securityHandler wrapper implementation
-
setSecurityHandler
public void setSecurityHandler(SecurityHandlerWrapper s)
Specify the SecurityHandler implementation.- Parameters:
s- the securityHandler wrapper implementation.
-
prepareConnection
protected void prepareConnection() throws CoreException- Specified by:
prepareConnectionin classAdaptrisConnectionImp- Throws:
CoreException
-
getHttpConfiguration
public KeyValuePairSet getHttpConfiguration()
- Returns:
- the httpConfiguration
-
setHttpConfiguration
public void setHttpConfiguration(KeyValuePairSet kvps)
- Parameters:
kvps- the httpConfiguration to set
-
-