Apache Tomcat 7.0.42

## org.apache.catalina.connector
Class Connector

    java.lang.Object
      org.apache.catalina.util.LifecycleBase
          org.apache.catalina.util.LifecycleMBeanBase
              org.apache.catalina.connector.Connector

All Implemented Interfaces:
  MBeanRegistration, Lifecycle

    public class Connector

extends LifecycleMBeanBase

Implementation of a Coyote connector.

Version:
  $Id: Connector.java 1353509 2012-06-25 13:05:03Z markt $
Author:
  Craig R. McClanahan, Remy Maucherat

Field Summary
`protected Adapter` `adapter` Coyote adapter.
`protected boolean` `allowTrace` Do we allow TRACE ?
`protected long` `asyncTimeout` Default timeout for asynchronous requests (ms).
`protected boolean` `enableLookups` The "enable DNS lookups" flag for this Connector.
`protected static String` `info` Descriptive information about this Connector implementation.
`protected Mapper` `mapper` Mapper.
`protected MapperListener` `mapperListener` Mapper listener.
`protected int` `maxParameterCount` The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. 10000 by default.
`protected int` `maxPostSize` Maximum size of a POST which will be automatically parsed by the container. 2MB by default.
`protected int` `maxSavePostSize` Maximum size of a POST which will be saved by the container during authentication. 4kB by default
`protected String` `parseBodyMethods` Comma-separated list of HTTP methods that will be parsed according to POST-style rules for application/x-www-form-urlencoded request bodies.
`protected HashSet<String>` `parseBodyMethodsSet` A Set of methods determined by `parseBodyMethods`.
`protected int` `port` The port number on which we listen for requests.
`protected ProtocolHandler` `protocolHandler` Coyote protocol handler.
`protected String` `protocolHandlerClassName` Coyote Protocol handler class name.
`protected String` `proxyName` The server name to which we should pretend requests to this Connector were directed.
`protected int` `proxyPort` The server port to which we should pretend requests to this Connector were directed.
`static boolean` `RECYCLE_FACADES` Alternate flag to enable recycling of facades.
`protected int` `redirectPort` The redirect port for non-SSL to SSL redirects.
`protected static HashMap<String,String>` `replacements`
`protected String` `scheme` The request scheme that will be set on all requests received through this connector.
`protected boolean` `secure` The secure connection flag that will be set on all requests received through this connector.
`protected Service` `service` The `Service` we are associated with (if any).
`protected static StringManager` `sm` The string manager for this package.
`protected String` `URIEncoding` URI encoding.
`protected boolean` `useBodyEncodingForURI` URI encoding as body.
`protected boolean` `useIPVHosts` Flag to use IP-based virtual hosting.
`protected boolean` `xpoweredBy`

Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase
`mserver`

Fields inherited from interface org.apache.catalina.Lifecycle
`AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT`

Constructor Summary
`Connector()`
`Connector(String protocol)`

Method Summary
`protected String` `createObjectNameKeyProperties(String type)`
`Request` `createRequest()` Create (or allocate) and return a Request object suitable for specifying the contents of a Request to the responsible Container.
`Response` `createResponse()` Create (or allocate) and return a Response object suitable for receiving the contents of a Response from the responsible Container.
`protected void` `destroyInternal()` Sub-classes wishing to perform additional clean-up should override this method, ensuring that super.destroyInternal() is the last call in the overriding method.
`boolean` `getAllowTrace()` True if the TRACE method is allowed.
`long` `getAsyncTimeout()` Return the default timeout for async requests in ms.
`Object` `getAttribute(String name)` Return a configured property.
`protected String` `getDomainInternal()` Method implemented by sub-classes to identify the domain in which MBeans should be registered.
`boolean` `getEnableLookups()` Return the "enable DNS lookups" flag.
`String` `getExecutorName()`
`String` `getInfo()` Return descriptive information about this Connector implementation.
`int` `getLocalPort()` Return the port number on which this connector is listening to requests.
`Mapper` `getMapper()` Return the mapper.
`int` `getMaxHeaderCount()` Return the maximum number of headers that are allowed by the container.
`int` `getMaxParameterCount()` Return the maximum number of parameters (GET plus POST) that will be automatically parsed by the container.
`int` `getMaxPostSize()` Return the maximum size of a POST which will be automatically parsed by the container.
`int` `getMaxSavePostSize()` Return the maximum size of a POST which will be saved by the container during authentication.
`protected String` `getObjectNameKeyProperties()` Allow sub-classes to specify the key properties component of the `ObjectName` that will be used to register this component.
`String` `getParseBodyMethods()`
`int` `getPort()` Return the port number on which this connector is configured to listen for requests.
`Object` `getProperty(String name)` Return a configured property.
`String` `getProtocol()` Return the Coyote protocol handler in use.
`ProtocolHandler` `getProtocolHandler()` Return the protocol handler associated with the connector.
`String` `getProtocolHandlerClassName()` Return the class name of the Coyote protocol handler in use.
`String` `getProxyName()` Return the proxy server name for this Connector.
`int` `getProxyPort()` Return the proxy server port for this Connector.
`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.
`String` `getScheme()` Return the scheme that will be assigned to requests received through this connector.
`boolean` `getSecure()` Return the secure connection flag that will be assigned to requests received through this connector.
`Service` `getService()` Return the `Service` with which we are associated (if any).
`String` `getURIEncoding()` Return the character encoding to be used for the URI.
`boolean` `getUseBodyEncodingForURI()` Return the true if the entity body encoding should be used for the URI.
`boolean` `getUseIPVHosts()` Test if IP-based virtual hosting is enabled.
`boolean` `getXpoweredBy()` Indicates whether the generation of an X-Powered-By response header for servlet-generated responses is enabled or disabled for this Connector.
`protected void` `initInternal()` Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.
`protected boolean` `isParseBodyMethod(String method)`
`void` `pause()` Pause the connector.
`void` `resume()` Pause the connector.
`void` `setAllowTrace(boolean allowTrace)` Set the allowTrace flag, to disable or enable the TRACE HTTP method.
`void` `setAsyncTimeout(long asyncTimeout)` Set the default timeout for async requests.
`void` `setAttribute(String name, Object value)` Set a configured property.
`void` `setEnableLookups(boolean enableLookups)` Set the "enable DNS lookups" flag.
`void` `setMaxHeaderCount(int maxHeaderCount)` Set the maximum number of headers in a request that are allowed by the container.
`void` `setMaxParameterCount(int maxParameterCount)` Set the maximum number of parameters (GET plus POST) that will be automatically parsed by the container.
`void` `setMaxPostSize(int maxPostSize)` Set the maximum size of a POST which will be automatically parsed by the container.
`void` `setMaxSavePostSize(int maxSavePostSize)` Set the maximum size of a POST which will be saved by the container during authentication.
`void` `setParseBodyMethods(String methods)`
`void` `setPort(int port)` Set the port number on which we listen for requests.
`boolean` `setProperty(String name, String value)` Set a configured property.
`void` `setProtocol(String protocol)` Set the Coyote protocol which will be used by the connector.
`void` `setProtocolHandlerClassName(String protocolHandlerClassName)` Set the class name of the Coyote protocol handler which will be used by the connector.
`void` `setProxyName(String proxyName)` Set the proxy server name for this Connector.
`void` `setProxyPort(int proxyPort)` Set the proxy server port for this Connector.
`void` `setRedirectPort(int redirectPort)` Set the redirect port number.
`void` `setScheme(String scheme)` Set the scheme that will be assigned to requests received through this connector.
`void` `setSecure(boolean secure)` Set the secure connection flag that will be assigned to requests received through this connector.
`void` `setService(Service service)` Set the `Service` with which we are associated (if any).
`void` `setURIEncoding(String URIEncoding)` Set the URI encoding to be used for the URI.
`void` `setUseBodyEncodingForURI(boolean useBodyEncodingForURI)` Set if the entity body encoding should be used for the URI.
`void` `setUseIPVHosts(boolean useIPVHosts)` Enable the use of IP-based virtual hosting.
`void` `setXpoweredBy(boolean xpoweredBy)` Enables or disables the generation of an X-Powered-By header (with value Servlet/2.5) for all servlet-generated responses returned by this Connector.
`protected void` `startInternal()` Begin processing requests via this Connector.
`protected void` `stopInternal()` Terminate processing requests via this Connector.
`String` `toString()` Provide a useful toString() implementation as it may be used when logging Lifecycle errors to identify the component.

Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
`getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister`

Methods inherited from class org.apache.catalina.util.LifecycleBase
`addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### RECYCLE_FACADES

    public static final boolean RECYCLE_FACADES

  Alternate flag to enable recycling of facades.

### service

    protected Service service

  The `Service` we are associated with (if any).

### allowTrace

    protected boolean allowTrace

  Do we allow TRACE ?

### asyncTimeout

    protected long asyncTimeout

  Default timeout for asynchronous requests (ms).

### enableLookups

    protected boolean enableLookups

  The "enable DNS lookups" flag for this Connector.

### xpoweredBy

    protected boolean xpoweredBy

### info

    protected static final String info

  Descriptive information about this Connector implementation.

  See Also:
    Constant Field Values

### port

    protected int port

  The port number on which we listen for requests.

### proxyName

    protected String proxyName

  The server name to which we should pretend requests to this Connector were directed. This is useful when operating Tomcat behind a proxy server, so that redirects get constructed accurately. If not specified, the server name included in the `Host` header is used.

### proxyPort

    protected int proxyPort

  The server port to which we should pretend requests to this Connector were directed. This is useful when operating Tomcat behind a proxy server, so that redirects get constructed accurately. If not specified, the port number specified by the `port` property is used.

### redirectPort

    protected int redirectPort

  The redirect port for non-SSL to SSL redirects.

### scheme

    protected String scheme

  The request scheme that will be set on all requests received through this connector.

### secure

    protected boolean secure

  The secure connection flag that will be set on all requests received through this connector.

### sm

    protected static final StringManager sm

  The string manager for this package.

### maxParameterCount

    protected int maxParameterCount

  The maximum number of parameters (GET plus POST) which will be automatically parsed by the container. 10000 by default. A value of less than 0 means no limit.

### maxPostSize

    protected int maxPostSize

  Maximum size of a POST which will be automatically parsed by the container. 2MB by default.

### maxSavePostSize

    protected int maxSavePostSize

  Maximum size of a POST which will be saved by the container during authentication. 4kB by default

### parseBodyMethods

    protected String parseBodyMethods

  Comma-separated list of HTTP methods that will be parsed according to POST-style rules for application/x-www-form-urlencoded request bodies.

### parseBodyMethodsSet

    protected HashSet<String> parseBodyMethodsSet

  A Set of methods determined by `parseBodyMethods`.

### useIPVHosts

    protected boolean useIPVHosts

  Flag to use IP-based virtual hosting.

### protocolHandlerClassName

    protected String protocolHandlerClassName

  Coyote Protocol handler class name. Defaults to the Coyote HTTP/1.1 protocolHandler.

### protocolHandler

    protected ProtocolHandler protocolHandler

  Coyote protocol handler.

### adapter

    protected Adapter adapter

  Coyote adapter.

### mapper

    protected Mapper mapper

  Mapper.

### mapperListener

    protected MapperListener mapperListener

  Mapper listener.

### URIEncoding

    protected String URIEncoding

  URI encoding.

### useBodyEncodingForURI

    protected boolean useBodyEncodingForURI

  URI encoding as body.

### replacements

    protected static HashMap<String,String> replacements

Constructor Detail

### Connector

    public Connector()

### Connector

    public Connector(String protocol)

Method Detail

### getProperty

    public Object getProperty(String name)

  Return a configured property.

### setProperty

    public boolean setProperty(String name,
                               String value)

  Set a configured property.

### getAttribute

    public Object getAttribute(String name)

  Return a configured property.

### setAttribute

    public void setAttribute(String name,
                             Object value)

  Set a configured property.

### getService

    public Service getService()

  Return the `Service` with which we are associated (if any).

### setService

    public void setService(Service service)

  Set the `Service` with which we are associated (if any).

  Parameters:
    `service` - The service that owns this Engine

### 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

### getAsyncTimeout

    public long getAsyncTimeout()

  Return the default timeout for async requests in ms.

### setAsyncTimeout

    public void setAsyncTimeout(long asyncTimeout)

  Set the default timeout for async requests.

  Parameters:
    `asyncTimeout` - The new timeout in ms.

### getEnableLookups

    public boolean getEnableLookups()

  Return the "enable DNS lookups" flag.

### setEnableLookups

    public void setEnableLookups(boolean enableLookups)

  Set the "enable DNS lookups" flag.

  Parameters:
    `enableLookups` - The new "enable DNS lookups" flag value

### getInfo

    public String getInfo()

  Return descriptive information about this Connector implementation.

### getMapper

    public Mapper getMapper()

  Return the mapper.

### getMaxHeaderCount

    public int getMaxHeaderCount()

  Return the maximum number of headers that are allowed by the container. A value of less than 0 means no limit.

### setMaxHeaderCount

    public void setMaxHeaderCount(int maxHeaderCount)

  Set the maximum number of headers in a request that are allowed by the container. A value of less than 0 means no limit.

  Parameters:
    `maxHeaderCount` - The new setting

### getMaxParameterCount

    public int getMaxParameterCount()

  Return the maximum number of parameters (GET plus POST) that will be automatically parsed by the container. A value of less than 0 means no limit.

### setMaxParameterCount

    public void setMaxParameterCount(int maxParameterCount)

  Set the maximum number of parameters (GET plus POST) that will be automatically parsed by the container. A value of less than 0 means no limit.

  Parameters:
    `maxParameterCount` - The new setting

### 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.

  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.

### 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.

### getParseBodyMethods

    public String getParseBodyMethods()

### setParseBodyMethods

    public void setParseBodyMethods(String methods)

### isParseBodyMethod

    protected boolean isParseBodyMethod(String method)

### getPort

    public int getPort()

  Return the port number on which this connector is configured to listen for requests. The special value of 0 means select a random free port when the socket is bound.

### setPort

    public void setPort(int port)

  Set the port number on which we listen for requests.

  Parameters:
    `port` - The new port number

### getLocalPort

    public int getLocalPort()

  Return the port number on which this connector is listening to requests. If the special value for `port` of zero is used then this method will report the actual port bound.

### 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.

### setRedirectPort

    public void setRedirectPort(int redirectPort)

  Set the redirect port number.

  Parameters:
    `redirectPort` - The redirect port number (non-SSL to SSL)

### getScheme

    public String getScheme()

  Return the scheme that will be assigned to requests received through this connector. Default value is "http".

### setScheme

    public void setScheme(String scheme)

  Set the scheme that will be assigned to requests received through this 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".

### setSecure

    public void setSecure(boolean secure)

  Set the secure connection flag that will be assigned to requests received through this connector.

  Parameters:
    `secure` - The new secure connection flag

### getURIEncoding

    public String getURIEncoding()

  Return the character encoding to be used for the URI.

### setURIEncoding

    public void setURIEncoding(String URIEncoding)

  Set the URI encoding to be used for the URI.

  Parameters:
    `URIEncoding` - The new URI character encoding.

### getUseBodyEncodingForURI

    public boolean getUseBodyEncodingForURI()

  Return the true if the entity body encoding should be used for the URI.

### setUseBodyEncodingForURI

    public void setUseBodyEncodingForURI(boolean useBodyEncodingForURI)

  Set if the entity body encoding should be used for the URI.

  Parameters:
    `useBodyEncodingForURI` - The new value for the flag.

### getXpoweredBy

    public boolean getXpoweredBy()

  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.5) 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

### setUseIPVHosts

    public void setUseIPVHosts(boolean useIPVHosts)

  Enable the use of IP-based virtual hosting.

  Parameters:
    `useIPVHosts` - `true` if Hosts are identified by IP, `false/code> if Hosts are identified by name.`

### getUseIPVHosts

    public boolean getUseIPVHosts()

  Test if IP-based virtual hosting is enabled.

### getExecutorName

    public String getExecutorName()

### createRequest

    public Request createRequest()

  Create (or allocate) and return a Request object suitable for specifying the contents of a Request to the responsible Container.

### createResponse

    public Response createResponse()

  Create (or allocate) and return a Response object suitable for receiving the contents of a Response from the responsible Container.

### createObjectNameKeyProperties

    protected String createObjectNameKeyProperties(String type)

### pause

    public void pause()

  Pause the connector.

### resume

    public void resume()

  Pause the connector.

### initInternal

    protected void initInternal()
                         throws LifecycleException

  Description copied from class: `LifecycleMBeanBase`
  Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method.

  Overrides:
    `initInternal` in class `LifecycleMBeanBase`
  Throws:
    `LifecycleException`

### startInternal

    protected void startInternal()
                          throws LifecycleException

  Begin processing requests via this Connector.

  Specified by:
    `startInternal` in class `LifecycleBase`
  Throws:
    `LifecycleException` - if a fatal startup error occurs

### stopInternal

    protected void stopInternal()
                         throws LifecycleException

  Terminate processing requests via this Connector.

  Specified by:
    `stopInternal` in class `LifecycleBase`
  Throws:
    `LifecycleException` - if a fatal shutdown error occurs

### destroyInternal

    protected void destroyInternal()
                            throws LifecycleException

  Description copied from class: `LifecycleMBeanBase`
  Sub-classes wishing to perform additional clean-up should override this method, ensuring that super.destroyInternal() is the last call in the overriding method.

  Overrides:
    `destroyInternal` in class `LifecycleMBeanBase`
  Throws:
    `LifecycleException`

### toString

    public String toString()

  Provide a useful toString() implementation as it may be used when logging Lifecycle errors to identify the component.

  Overrides:
    `toString` in class `Object`

### getDomainInternal

    protected String getDomainInternal()

  Description copied from class: `LifecycleMBeanBase`
  Method implemented by sub-classes to identify the domain in which MBeans should be registered.

  Specified by:
    `getDomainInternal` in class `LifecycleMBeanBase`
  Returns:
    The name of the domain to use to register MBeans.

### getObjectNameKeyProperties

    protected String getObjectNameKeyProperties()

  Description copied from class: `LifecycleMBeanBase`
  Allow sub-classes to specify the key properties component of the `ObjectName` that will be used to register this component.

  Specified by:
    `getObjectNameKeyProperties` in class `LifecycleMBeanBase`
  Returns:
    The string representation of the key properties component of the desired `ObjectName`

Apache Tomcat 7.0.42

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.