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 JettyConnection
Concrete 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-properties
element should match the name of the underlyingServerConnector
setter.<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 theAbstractConnector
with an attempt to transform into the correct type. Invalid combinations may result in undefined behaviour. Similarly additionalHttpConfiguration
properties can be configured via thehttp-connection
element.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 class
HttpConnection.HttpConfigurationProperty
StandardHttpConfiguration
properties for use withsetHttpConfiguration(KeyValuePairSet)
.static class
HttpConnection.ServerConnectorProperty
StandardServerConnector
properties 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.ServerConnector
configure(org.eclipse.jetty.server.ServerConnector connector)
protected org.eclipse.jetty.server.HttpConfiguration
createConfig()
protected org.eclipse.jetty.server.ConnectionFactory[]
createConnectionFactory()
KeyValuePairSet
getHttpConfiguration()
int
getPort()
Get the port to listen on for HTTP traffic.SecurityHandlerWrapper
getSecurityHandler()
KeyValuePairSet
getServerConnectorProperties()
protected void
prepareConnection()
void
setHttpConfiguration(KeyValuePairSet kvps)
void
setPort(int i)
Set the port to listen on.void
setSecurityHandler(SecurityHandlerWrapper s)
Specify the SecurityHandler implementation.void
setServerConnectorProperties(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:
prepareConnection
in classAdaptrisConnectionImp
- Throws:
CoreException
-
getHttpConfiguration
public KeyValuePairSet getHttpConfiguration()
- Returns:
- the httpConfiguration
-
setHttpConfiguration
public void setHttpConfiguration(KeyValuePairSet kvps)
- Parameters:
kvps
- the httpConfiguration to set
-
-