Class Connector

  • All Implemented Interfaces:
    Connector, Lifecycle
    Direct Known Subclasses:
    PECoyoteConnector

    public class Connector
    extends Object
    implements Connector, Lifecycle
    Implementation of a Coyote connector for Tomcat 5.x.
    Version:
    $Revision: 1.23 $ $Date: 2007/07/09 20:46:45 $
    Author:
    Craig R. McClanahan, Remy Maucherat
    • Field Detail

      • container

        protected Container container
        The Container used for processing requests received by this Connector.
      • lifecycle

        protected LifecycleSupport lifecycle
        The lifecycle event support for this component.
      • minProcessors

        protected int minProcessors
        The minimum number of processors to start at initialization time.
      • maxSavePostSize

        protected int maxSavePostSize
        Maximum size of a POST which will be saved by the container during authentication. 4kB by default
      • initialized

        protected boolean initialized
        Has this component been initialized yet?
      • mapper

        protected org.glassfish.grizzly.http.server.util.Mapper mapper
        Mapper.
      • authPassthroughEnabled

        protected boolean authPassthroughEnabled
        Flag indicating whether this connector is receiving its requests from a trusted intermediate server
      • domain

        protected String domain
    • Constructor Detail

      • Connector

        public Connector()
    • Method Detail

      • getProperty

        public String getProperty​(String name)
        Return a configured property.
      • setProperty

        public void setProperty​(String name,
                                String value)
        Set a configured property.
      • removeProperty

        public void removeProperty​(String name)
        remove a configured property.
      • getService

        public Service getService()
        Return the Service with which we are associated (if any).
        Specified by:
        getService in interface Connector
      • setService

        public void setService​(Service service)
        Set the Service with which we are associated (if any).
        Specified by:
        setService in interface Connector
        Parameters:
        service - The service that owns this Engine
      • getCompression

        public String getCompression()
        Get the value of compression.
      • setCompression

        public void setCompression​(String compression)
        Set the value of compression.
        Parameters:
        compression - The new compression value, which can be "on", "off" or "force"
      • getConnectionLinger

        public int getConnectionLinger()
        Return the connection linger for this Connector.
      • setConnectionLinger

        public void setConnectionLinger​(int connectionLinger)
        Set the connection linger for this Connector.
        Parameters:
        connectionLinger - The new connection linger
      • getConnectionTimeout

        public int getConnectionTimeout()
        Return the connection timeout for this Connector.
      • setConnectionTimeout

        public void setConnectionTimeout​(int connectionTimeout)
        Set the connection timeout for this Connector.
        Parameters:
        connectionTimeout - The new connection timeout
      • getConnectionUploadTimeout

        public int getConnectionUploadTimeout()
        Return the connection upload timeout for this Connector.
      • setConnectionUploadTimeout

        public void setConnectionUploadTimeout​(int connectionUploadTimeout)
        Set the connection upload timeout for this Connector.
        Parameters:
        connectionUploadTimeout - The new connection upload timeout
      • getServerSocketTimeout

        public int getServerSocketTimeout()
        Return the server socket timeout for this Connector.
      • setServerSocketTimeout

        public void setServerSocketTimeout​(int serverSocketTimeout)
        Set the server socket timeout for this Connector.
        Parameters:
        serverSocketTimeout - The new server socket timeout
      • getAcceptCount

        public int getAcceptCount()
        Return the accept count for this Connector.
      • setAcceptCount

        public void setAcceptCount​(int count)
        Set the accept count for this Connector.
        Parameters:
        count - The new accept count
      • getAddress

        public String getAddress()
        Return the bind IP address for this Connector.
      • setAddress

        public void setAddress​(String address)
        Set the bind IP address for this Connector.
        Parameters:
        address - The bind IP address
      • getAllowTrace

        public boolean getAllowTrace()
        True if the TRACE method is allowed. Default value is "false".
      • setAllowTrace

        public void setAllowTrace​(boolean allowTrace)
        Set the allowTrace flag, to disable or enable the TRACE HTTP method.
        Parameters:
        allowTrace - The new allowTrace flag
      • isAvailable

        public boolean isAvailable()
        Is this connector available for processing requests?
      • getBufferSize

        public int getBufferSize()
        Return the input buffer size for this Connector.
      • setBufferSize

        public void setBufferSize​(int bufferSize)
        Set the input buffer size for this Connector.
        Parameters:
        bufferSize - The new input buffer size.
      • getContainer

        public Container getContainer()
        Return the Container used for processing requests received by this Connector.
        Specified by:
        getContainer in interface Connector
      • setContainer

        public void setContainer​(Container container)
        Set the Container used for processing requests received by this Connector.
        Specified by:
        setContainer in interface Connector
        Parameters:
        container - The new Container to use
      • getDebug

        public int getDebug()
        Return the debugging detail level for this component.
      • setDebug

        public void setDebug​(int debug)
        Set the debugging detail level for this component.
        Parameters:
        debug - The new debugging detail level
      • getEnableLookups

        public boolean getEnableLookups()
        Return the "enable DNS lookups" flag.
        Specified by:
        getEnableLookups in interface Connector
      • setEnableLookups

        public void setEnableLookups​(boolean enableLookups)
        Set the "enable DNS lookups" flag.
        Specified by:
        setEnableLookups in interface Connector
        Parameters:
        enableLookups - The new "enable DNS lookups" flag value
      • setFactory

        public void setFactory​(ServerSocketFactory factory)
        Set the server socket factory used by this Container.
        Specified by:
        setFactory in interface Connector
        Parameters:
        factory - The new server socket factory
      • getInfo

        public String getInfo()
        Return descriptive information about this Connector implementation.
        Specified by:
        getInfo in interface Connector
      • getMapper

        public org.glassfish.grizzly.http.server.util.Mapper getMapper()
        Return the mapper.
      • setMapper

        public void setMapper​(org.glassfish.grizzly.http.server.util.Mapper mapper)
        Set the Mapper.
        Parameters:
        mapper -
      • getMinProcessors

        public int getMinProcessors()
        Return the minimum number of processors to start at initialization.
      • setMinProcessors

        public void setMinProcessors​(int minProcessors)
        Set the minimum number of processors to start at initialization.
        Parameters:
        minProcessors - The new minimum processors
      • getMaxProcessors

        public int getMaxProcessors()
        Return the maximum number of processors allowed, or <0 for unlimited.
      • setMaxProcessors

        public void setMaxProcessors​(int maxProcessors)
        Set the maximum number of processors allowed, or <0 for unlimited.
        Parameters:
        maxProcessors - The new maximum processors
      • getMaxPostSize

        public int getMaxPostSize()
        Return the maximum size of a POST which will be automatically parsed by the container.
      • setMaxPostSize

        public void setMaxPostSize​(int maxPostSize)
        Set the maximum size of a POST which will be automatically parsed by the container.
        Specified by:
        setMaxPostSize in interface Connector
        Parameters:
        maxPostSize - The new maximum size in bytes of a POST which will be automatically parsed by the container
      • getMaxSavePostSize

        public int getMaxSavePostSize()
        Return the maximum size of a POST which will be saved by the container during authentication.
        Specified by:
        getMaxSavePostSize in interface Connector
        Returns:
        maximum size in bytes
      • setMaxSavePostSize

        public void setMaxSavePostSize​(int maxSavePostSize)
        Set the maximum size of a POST which will be saved by the container during authentication.
        Parameters:
        maxSavePostSize - The new maximum size in bytes of a POST which will be saved by the container during authentication.
      • getPort

        public int getPort()
        Return the port number on which we listen for requests.
      • setPort

        public void setPort​(int port)
        Set the port number on which we listen for requests.
        Parameters:
        port - The new port number
      • setName

        public void setName​(String name)
        Sets the name of this Connector.
      • getName

        public String getName()
        Gets the name of this Connector.
        Specified by:
        getName in interface Connector
      • setInstanceName

        public void setInstanceName​(String instanceName)
        Sets the instance name for this Connector.
        Parameters:
        instanceName - the instance name
      • getInstanceName

        public String getInstanceName()
      • getProtocol

        public String getProtocol()
        Return the Coyote protocol handler in use.
      • setProtocol

        public void setProtocol​(String protocol)
        Set the Coyote protocol which will be used by the connector.
        Parameters:
        protocol - The Coyote protocol name
      • getProtocolHandlerClassName

        public String getProtocolHandlerClassName()
        Return the class name of the Coyote protocol handler in use.
      • setProtocolHandlerClassName

        public void setProtocolHandlerClassName​(String protocolHandlerClassName)
        Set the class name of the Coyote protocol handler which will be used by the connector.
        Parameters:
        protocolHandlerClassName - The new class name
      • getProtocolHandler

        public ProtocolHandler getProtocolHandler()
        Return the protocol handler associated with the connector.
      • getProxyName

        public String getProxyName()
        Return the proxy server name for this Connector.
      • setProxyName

        public void setProxyName​(String proxyName)
        Set the proxy server name for this Connector.
        Parameters:
        proxyName - The new proxy server name
      • getProxyPort

        public int getProxyPort()
        Return the proxy server port for this Connector.
      • setProxyPort

        public void setProxyPort​(int proxyPort)
        Set the proxy server port for this Connector.
        Parameters:
        proxyPort - The new proxy server port
      • getRedirectPort

        public int getRedirectPort()
        Return the port number to which a request should be redirected if it comes in on a non-SSL port and is subject to a security constraint with a transport guarantee that requires SSL.
        Specified by:
        getRedirectPort in interface Connector
      • setRedirectPort

        public void setRedirectPort​(int redirectPort)
        Set the redirect port number.
        Specified by:
        setRedirectPort in interface Connector
        Parameters:
        redirectPort - The redirect port number (non-SSL to SSL)
      • getDisableUploadTimeout

        public boolean getDisableUploadTimeout()
        Return the flag that specifies upload time-out behavior.
      • setDisableUploadTimeout

        public void setDisableUploadTimeout​(boolean isDisabled)
        Set the flag to specify upload time-out behavior.
        Parameters:
        isDisabled - If true, then the timeout parameter is ignored. If false, then the timeout parameter is used to control uploads.
      • getMaxHttpHeaderSize

        public int getMaxHttpHeaderSize()
        Return the maximum HTTP header size.
      • setMaxHttpHeaderSize

        public void setMaxHttpHeaderSize​(int size)
        Set the maximum HTTP header size.
      • getKeepAlive

        public boolean getKeepAlive()
        Return the Keep-Alive policy for the connection.
      • setKeepAlive

        public void setKeepAlive​(boolean keepAlive)
        Set the keep-alive policy for this connection.
      • getMaxKeepAliveRequests

        public int getMaxKeepAliveRequests()
        Return the maximum number of Keep-Alive requests to honor per connection.
      • setMaxKeepAliveRequests

        public void setMaxKeepAliveRequests​(int mkar)
        Set the maximum number of Keep-Alive requests to honor per connection.
      • getScheme

        public String getScheme()
        Return the scheme that will be assigned to requests received through this connector. Default value is "http".
        Specified by:
        getScheme in interface Connector
      • setScheme

        public void setScheme​(String scheme)
        Set the scheme that will be assigned to requests received through this connector.
        Specified by:
        setScheme in interface Connector
        Parameters:
        scheme - The new scheme
      • getSecure

        public boolean getSecure()
        Return the secure connection flag that will be assigned to requests received through this connector. Default value is "false".
        Specified by:
        getSecure in interface Connector
      • setSecure

        public void setSecure​(boolean secure)
        Set the secure connection flag that will be assigned to requests received through this connector.
        Specified by:
        setSecure in interface Connector
        Parameters:
        secure - The new secure connection flag
      • getBlocking

        public boolean getBlocking()
        Return the blocking connection flag that will be assigned to requests received through this connector. Default value is "false".
      • setBlocking

        public void setBlocking​(boolean blocking)
        Set the blocking connection flag that will be assigned to requests received through this connector.
        Parameters:
        blocking - The new blocking connection flag
      • getTomcatAuthentication

        public boolean getTomcatAuthentication()
      • setTomcatAuthentication

        public void setTomcatAuthentication​(boolean tomcatAuthentication)
      • getTcpNoDelay

        public boolean getTcpNoDelay()
        Return the TCP no delay flag value.
      • setTcpNoDelay

        public void setTcpNoDelay​(boolean tcpNoDelay)
        Set the TCP no delay flag which will be set on the socket after accepting a connection.
        Parameters:
        tcpNoDelay - The new TCP no delay flag
      • getURIEncoding

        public String getURIEncoding()
        Return the character encoding to be used for the URI.
        Specified by:
        getURIEncoding in interface Connector
      • setURIEncoding

        public void setURIEncoding​(String uriEncoding)
        Set the URI encoding to be used for the URI.
        Specified by:
        setURIEncoding in interface Connector
        Parameters:
        uriEncoding - The new URI character encoding.
      • isXpoweredBy

        public boolean isXpoweredBy()
        Indicates whether the generation of an X-Powered-By response header for servlet-generated responses is enabled or disabled for this Connector.
        Returns:
        true if generation of X-Powered-By response header is enabled, false otherwise
      • setXpoweredBy

        public void setXpoweredBy​(boolean xpoweredBy)
        Enables or disables the generation of an X-Powered-By header (with value Servlet/2.4) for all servlet-generated responses returned by this Connector.
        Parameters:
        xpoweredBy - true if generation of X-Powered-By response header is to be enabled, false otherwise
      • isServerHeader

        public boolean isServerHeader()
        Indicates whether the generation of a Server response header for servlet-generated responses is enabled or disabled for this Connector.
        Returns:
        true if generation of Server response header is enabled, false otherwise
      • setServerHeader

        public void setServerHeader​(boolean serverHeader)
        Enables or disables the generation of a Server header (with value Servlet/2.4) for all servlet-generated responses returned by this Connector.
        Parameters:
        serverHeader - true if generation of Server response header is to be enabled, false otherwise
      • isXframeOptions

        public boolean isXframeOptions()
        Indicates whether the generation of an X-Frame-Options response header for servlet-generated responses is enabled or disabled for this Connector.
        Returns:
        true if generation of X-Frame-Options response header is enabled, false otherwise
      • setXframeOptions

        public void setXframeOptions​(boolean xframeOptions)
        Enables or disables the generation of an X-Frame-Options header (with value Servlet/2.4) for all servlet-generated responses returned by this Connector.
        Parameters:
        xframeOptions - true if generation of X-Frame-Options response header is to be enabled, false otherwise
      • setDefaultHost

        public void setDefaultHost​(String defaultHost)
        Sets the default host for this Connector.
        Specified by:
        setDefaultHost in interface Connector
        Parameters:
        defaultHost - The default host for this Connector
      • getDefaultHost

        public String getDefaultHost()
        Gets the default host of this Connector.
        Specified by:
        getDefaultHost in interface Connector
        Returns:
        The default host of this Connector
      • getAuthPassthroughEnabled

        public boolean getAuthPassthroughEnabled()
        Returns the value of this connector's authPassthroughEnabled flag.
        Specified by:
        getAuthPassthroughEnabled in interface Connector
        Returns:
        true if this connector is receiving its requests from a trusted intermediate server, false otherwise
      • setAuthPassthroughEnabled

        public void setAuthPassthroughEnabled​(boolean authPassthroughEnabled)
        Sets the value of this connector's authPassthroughEnabled flag.
        Specified by:
        setAuthPassthroughEnabled in interface Connector
        Parameters:
        authPassthroughEnabled - true if this connector is receiving its requests from a trusted intermediate server, false otherwise
      • getProxyHandler

        public ProxyHandler getProxyHandler()
        Gets the ProxyHandler instance associated with this CoyoteConnector.
        Specified by:
        getProxyHandler in interface Connector
        Returns:
        ProxyHandler instance associated with this CoyoteConnector, or null
      • setProxyHandler

        public void setProxyHandler​(ProxyHandler proxyHandler)
        Sets the ProxyHandler implementation for this CoyoteConnector to use.
        Specified by:
        setProxyHandler in interface Connector
        Parameters:
        proxyHandler - ProxyHandler instance to use
      • setEnabled

        public void setEnabled​(boolean enabled)
      • isEnabled

        public boolean isEnabled()
      • setJvmRoute

        public void setJvmRoute​(String jvmRoute)
        Description copied from interface: Connector
        Sets the jvmRoute associated with this connector.
        Specified by:
        setJvmRoute in interface Connector
      • getJvmRoute

        public String getJvmRoute()
        Description copied from interface: Connector
        Get the jvmRoute associated with this connector.
        Specified by:
        getJvmRoute in interface Connector
      • createRequest

        public Request createRequest()
        Create (or allocate) and return a Request object suitable for specifying the contents of a Request to the responsible Container.
        Specified by:
        createRequest in interface Connector
      • createResponse

        public Response createResponse()
        Create (or allocate) and return a Response object suitable for receiving the contents of a Response from the responsible Container.
        Specified by:
        createResponse in interface Connector
      • requestStartEvent

        public void requestStartEvent​(jakarta.servlet.http.HttpServletRequest request,
                                      Host host,
                                      Context context)
        Fires probe event related to the fact that the given request has been entered the web container.
        Parameters:
        request - the request object
        host - the virtual server to which the request was mapped
        context - the Context to which the request was mapped
      • requestEndEvent

        public void requestEndEvent​(jakarta.servlet.http.HttpServletRequest request,
                                    Host host,
                                    Context context,
                                    int statusCode)
        Fires probe event related to the fact that the given request is about to exit from the web container.
        Parameters:
        request - the request object
        host - the virtual server to which the request was mapped
        context - the Context to which the request was mapped
        statusCode - the response status code
      • addLifecycleListener

        public void addLifecycleListener​(LifecycleListener listener)
        Add a lifecycle event listener to this component.
        Specified by:
        addLifecycleListener in interface Lifecycle
        Parameters:
        listener - The listener to add
      • removeLifecycleListener

        public void removeLifecycleListener​(LifecycleListener listener)
        Remove a lifecycle event listener from this component.
        Specified by:
        removeLifecycleListener in interface Lifecycle
        Parameters:
        listener - The listener to add
      • getClientAuth

        public boolean getClientAuth()
      • setClientAuth

        public void setClientAuth​(boolean clientAuth)
      • getKeystoreFile

        public String getKeystoreFile()
      • setKeystoreFile

        public void setKeystoreFile​(String keystoreFile)
      • getKeystorePass

        public String getKeystorePass()
        Return keystorePass
      • setKeystorePass

        public void setKeystorePass​(String keystorePass)
        Set keystorePass
      • getCiphers

        public String getCiphers()
        Gets the list of SSL cipher suites that are to be enabled
        Returns:
        Comma-separated list of SSL cipher suites, or null if all cipher suites supported by the underlying SSL implementation are being enabled
      • setCiphers

        public void setCiphers​(String ciphers)
        Sets the SSL cipher suites that are to be enabled. Only those SSL cipher suites that are actually supported by the underlying SSL implementation will be enabled.
        Parameters:
        ciphers - Comma-separated list of SSL cipher suites
      • getKeyAlias

        public String getKeyAlias()
        Gets the alias name of the keypair and supporting certificate chain used by this Connector to authenticate itself to SSL clients.
        Returns:
        The alias name of the keypair and supporting certificate chain
      • setKeyAlias

        public void setKeyAlias​(String alias)
        Sets the alias name of the keypair and supporting certificate chain used by this Connector to authenticate itself to SSL clients.
        Parameters:
        alias - The alias name of the keypair and supporting certificate chain
      • getSslProtocol

        public String getSslProtocol()
        Gets the SSL protocol variant to be used.
        Returns:
        SSL protocol variant
      • setSslProtocol

        public void setSslProtocol​(String sslProtocol)
        Sets the SSL protocol variant to be used.
        Parameters:
        sslProtocol - SSL protocol variant
      • getSslProtocols

        public String getSslProtocols()
        Gets the SSL protocol variants to be enabled.
        Returns:
        Comma-separated list of SSL protocol variants
      • setSslProtocols

        public void setSslProtocols​(String sslProtocols)
        Sets the SSL protocol variants to be enabled.
        Parameters:
        sslProtocols - Comma-separated list of SSL protocol variants
      • getController

        public ObjectName getController()
      • setController

        public void setController​(ObjectName controller)
      • getObjectName

        public ObjectName getObjectName()
      • getDomain

        public String getDomain()
      • setDomain

        public void setDomain​(String domain)
        Set the domain of this object.
      • setHandler

        public void setHandler​(org.glassfish.grizzly.http.server.HttpHandler handler)
        Set the Adapter used by this connector.
        Specified by:
        setHandler in interface Connector
      • getHandler

        public org.glassfish.grizzly.http.server.HttpHandler getHandler()
        Get the Adapter used by this connector.
        Specified by:
        getHandler in interface Connector
      • setProtocolHandler

        public void setProtocolHandler​(ProtocolHandler protocolHandler)
        Set the ProtocolHandler used by this connector.
      • getSelectorThreadImpl

        public String getSelectorThreadImpl()
        Get the underlying SelectorThread implementation, null if the default is used.
      • setSelectorThreadImpl

        public void setSelectorThreadImpl​(String selectorThreadImpl)
        Set the underlying SelectorThread implementation