Class 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 underlying ServerConnector setter.

     
       <server-connector-properties>
         <key-value-pair>
            <key>ReuseAddress</key>
            <value>true</value>
         </key-value-pair>
       </server-connector-properties>
     
     
    will invoke 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 the AbstractConnector with an attempt to transform into the correct type. Invalid combinations may result in undefined behaviour. Similarly additional HttpConfiguration properties can be configured via the http-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.

    • Constructor Detail

      • HttpConnection

        public HttpConnection()
    • 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.
      • getHttpConfiguration

        public KeyValuePairSet getHttpConfiguration()
        Returns:
        the httpConfiguration
      • setHttpConfiguration

        public void setHttpConfiguration​(KeyValuePairSet kvps)
        Parameters:
        kvps - the httpConfiguration to set