org.apache.catalina.connector

Class Connector

public class Connector extends Object implements Lifecycle, MBeanRegistration

Implementation of a Coyote connector for Tomcat 5.x.

Version: $Revision: 890942 $ $Date: 2009-12-15 20:00:23 +0100 (Tue, 15 Dec 2009) $

Author: Craig R. McClanahan Remy Maucherat

Field Summary
protected Adapteradapter
Coyote adapter.
protected booleanallowTrace
Do we allow TRACE ?
protected Containercontainer
The Container used for processing requests received by this Connector.
protected Stringdomain
protected booleanemptySessionPath
Use "/" as path for session cookies ?
protected booleanenableLookups
The "enable DNS lookups" flag for this Connector.
protected static Stringinfo
Descriptive information about this Connector implementation.
protected booleaninitialized
Has this component been initialized yet?
protected LifecycleSupportlifecycle
The lifecycle event support for this component.
protected Mappermapper
Mapper.
protected MapperListenermapperListener
Mapper listener.
protected intmaxPostSize
Maximum size of a POST which will be automatically parsed by the container.
protected intmaxSavePostSize
Maximum size of a POST which will be saved by the container during authentication.
protected MBeanServermserver
protected ObjectNameoname
protected intport
The port number on which we listen for requests.
protected ProtocolHandlerprotocolHandler
Coyote protocol handler.
protected StringprotocolHandlerClassName
Coyote Protocol handler class name.
protected StringproxyName
The server name to which we should pretend requests to this Connector were directed.
protected intproxyPort
The server port to which we should pretent requests to this Connector were directed.
protected intredirectPort
The redirect port for non-SSL to SSL redirects.
protected static HashMapreplacements
static booleanRECYCLE_FACADES
Alternate flag to enable recycling of facades.
protected Stringscheme
The request scheme that will be set on all requests received through this connector.
protected booleansecure
The secure connection flag that will be set on all requests received through this connector.
protected Serviceservice
The Service we are associated with (if any).
protected StringManagersm
The string manager for this package.
protected booleanstarted
Has this component been started yet?
protected booleanstopped
The shutdown signal to our background thread
protected Threadthread
The background thread.
protected booleanuseBodyEncodingForURI
URI encoding as body.
protected booleanuseIPVHosts
Flag to use IP-based virtual hosting.
protected StringURIEncoding
URI encoding.
protected booleanxpoweredBy
Constructor Summary
Connector()
Connector(String protocol)
Method Summary
voidaddLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
protected ObjectNamecreateObjectName(String domain, String type)
RequestcreateRequest()
Create (or allocate) and return a Request object suitable for specifying the contents of a Request to the responsible Container.
ResponsecreateResponse()
Create (or allocate) and return a Response object suitable for receiving the contents of a Response from the responsible Container.
voiddestroy()
protected voidfindContainer()
LifecycleListener[]findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle.
booleangetAllowTrace()
True if the TRACE method is allowed.
ObjectgetAttribute(String name)
Return a configured property.
intgetBufferSize()
Return the input buffer size for this Connector.
ContainergetContainer()
Return the Container used for processing requests received by this Connector.
ObjectNamegetController()
StringgetDomain()
booleangetEmptySessionPath()
Return the "empty session path" flag.
booleangetEnableLookups()
Return the "enable DNS lookups" flag.
StringgetInfo()
Return descriptive information about this Connector implementation.
MappergetMapper()
Return the mapper.
intgetMaxPostSize()
Return the maximum size of a POST which will be automatically parsed by the container.
intgetMaxSavePostSize()
Return the maximum size of a POST which will be saved by the container during authentication.
ObjectNamegetObjectName()
intgetPort()
Return the port number on which we listen for requests.
ObjectgetProperty(String name)
Return a configured property.
StringgetProtocol()
Return the Coyote protocol handler in use.
ProtocolHandlergetProtocolHandler()
Return the protocol handler associated with the connector.
StringgetProtocolHandlerClassName()
Return the class name of the Coyote protocol handler in use.
StringgetProxyName()
Return the proxy server name for this Connector.
intgetProxyPort()
Return the proxy server port for this Connector.
intgetRedirectPort()
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.
StringgetScheme()
Return the scheme that will be assigned to requests received through this connector.
booleangetSecure()
Return the secure connection flag that will be assigned to requests received through this connector.
ServicegetService()
Return the Service with which we are associated (if any).
StringgetURIEncoding()
Return the character encoding to be used for the URI.
booleangetUseBodyEncodingForURI()
Return the true if the entity body encoding should be used for the URI.
booleangetUseIPVHosts()
Test if IP-based virtual hosting is enabled.
booleangetXpoweredBy()
Indicates whether the generation of an X-Powered-By response header for servlet-generated responses is enabled or disabled for this Connector.
voidinit()
voidinitialize()
Initialize this connector (create ServerSocket here!)
booleanisAvailable()
Is this connector available for processing requests?
voidpause()
Pause the connector.
voidpostDeregister()
voidpostRegister(Boolean registrationDone)
voidpreDeregister()
ObjectNamepreRegister(MBeanServer server, ObjectName name)
voidremoveLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
voidremoveProperty(String name)
remove a configured property.
voidresume()
Pause the connector.
voidsetAllowTrace(boolean allowTrace)
Set the allowTrace flag, to disable or enable the TRACE HTTP method.
voidsetAttribute(String name, Object value)
Set a configured property.
voidsetBufferSize(int bufferSize)
Set the input buffer size for this Connector.
voidsetContainer(Container container)
Set the Container used for processing requests received by this Connector.
voidsetController(ObjectName controller)
voidsetEmptySessionPath(boolean emptySessionPath)
Set the "empty session path" flag.
voidsetEnableLookups(boolean enableLookups)
Set the "enable DNS lookups" flag.
voidsetMaxPostSize(int maxPostSize)
Set the maximum size of a POST which will be automatically parsed by the container.
voidsetMaxSavePostSize(int maxSavePostSize)
Set the maximum size of a POST which will be saved by the container during authentication.
voidsetPort(int port)
Set the port number on which we listen for requests.
booleansetProperty(String name, String value)
Set a configured property.
voidsetProtocol(String protocol)
Set the Coyote protocol which will be used by the connector.
voidsetProtocolHandlerClassName(String protocolHandlerClassName)
Set the class name of the Coyote protocol handler which will be used by the connector.
voidsetProxyName(String proxyName)
Set the proxy server name for this Connector.
voidsetProxyPort(int proxyPort)
Set the proxy server port for this Connector.
voidsetRedirectPort(int redirectPort)
Set the redirect port number.
voidsetScheme(String scheme)
Set the scheme that will be assigned to requests received through this connector.
voidsetSecure(boolean secure)
Set the secure connection flag that will be assigned to requests received through this connector.
voidsetService(Service service)
Set the Service with which we are associated (if any).
voidsetURIEncoding(String URIEncoding)
Set the URI encoding to be used for the URI.
voidsetUseBodyEncodingForURI(boolean useBodyEncodingForURI)
Set if the entity body encoding should be used for the URI.
voidsetUseIPVHosts(boolean useIPVHosts)
Enable the use of IP-based virtual hosting.
voidsetXpoweredBy(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.
voidstart()
Begin processing requests via this Connector.
voidstop()
Terminate processing requests via this Connector.

Field Detail

adapter

protected Adapter adapter
Coyote adapter.

allowTrace

protected boolean allowTrace
Do we allow TRACE ?

container

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

domain

protected String domain

emptySessionPath

protected boolean emptySessionPath
Use "/" as path for session cookies ?

enableLookups

protected boolean enableLookups
The "enable DNS lookups" flag for this Connector.

info

protected static final String info
Descriptive information about this Connector implementation.

initialized

protected boolean initialized
Has this component been initialized yet?

lifecycle

protected LifecycleSupport lifecycle
The lifecycle event support for this component.

mapper

protected Mapper mapper
Mapper.

mapperListener

protected MapperListener mapperListener
Mapper listener.

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

mserver

protected MBeanServer mserver

oname

protected ObjectName oname

port

protected int port
The port number on which we listen for requests.

protocolHandler

protected ProtocolHandler protocolHandler
Coyote protocol handler.

protocolHandlerClassName

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

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

replacements

protected static HashMap replacements

RECYCLE_FACADES

public static final boolean RECYCLE_FACADES
Alternate flag to enable recycling of facades.

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.

service

protected Service service
The Service we are associated with (if any).

sm

protected StringManager sm
The string manager for this package.

started

protected boolean started
Has this component been started yet?

stopped

protected boolean stopped
The shutdown signal to our background thread

thread

protected Thread thread
The background thread.

useBodyEncodingForURI

protected boolean useBodyEncodingForURI
URI encoding as body.

useIPVHosts

protected boolean useIPVHosts
Flag to use IP-based virtual hosting.

URIEncoding

protected String URIEncoding
URI encoding.

xpoweredBy

protected boolean xpoweredBy

Constructor Detail

Connector

public Connector()

Connector

public Connector(String protocol)

Method Detail

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.

Parameters: listener The listener to add

createObjectName

protected ObjectName createObjectName(String domain, String type)

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.

destroy

public void destroy()

findContainer

protected void findContainer()

findLifecycleListeners

public LifecycleListener[] findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

getAllowTrace

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

getAttribute

public Object getAttribute(String name)
Return a configured property.

getBufferSize

public int getBufferSize()

Deprecated:

Return the input buffer size for this Connector.

getContainer

public Container getContainer()
Return the Container used for processing requests received by this Connector.

getController

public ObjectName getController()

getDomain

public String getDomain()

getEmptySessionPath

public boolean getEmptySessionPath()
Return the "empty session path" flag.

getEnableLookups

public boolean getEnableLookups()
Return the "enable DNS lookups" flag.

getInfo

public String getInfo()
Return descriptive information about this Connector implementation.

getMapper

public Mapper getMapper()
Return the mapper.

getMaxPostSize

public int getMaxPostSize()
Return the maximum size 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.

getObjectName

public ObjectName getObjectName()

getPort

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

getProperty

public Object getProperty(String name)
Return a configured property.

getProtocol

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

getProtocolHandler

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

getProtocolHandlerClassName

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

getProxyName

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

getProxyPort

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

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.

getScheme

public String getScheme()
Return the scheme that will be assigned to requests received through this connector. Default value is "http".

getSecure

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

getService

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

getURIEncoding

public String getURIEncoding()
Return the character encoding to be used for the URI.

getUseBodyEncodingForURI

public boolean getUseBodyEncodingForURI()
Return the true if the entity body encoding should be used for the URI.

getUseIPVHosts

public boolean getUseIPVHosts()
Test if IP-based virtual hosting is enabled.

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

init

public void init()

initialize

public void initialize()
Initialize this connector (create ServerSocket here!)

isAvailable

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

pause

public void pause()
Pause the connector.

postDeregister

public void postDeregister()

postRegister

public void postRegister(Boolean registrationDone)

preDeregister

public void preDeregister()

preRegister

public ObjectName preRegister(MBeanServer server, ObjectName name)

removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.

Parameters: listener The listener to add

removeProperty

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

resume

public void resume()
Pause the connector.

setAllowTrace

public void setAllowTrace(boolean allowTrace)
Set the allowTrace flag, to disable or enable the TRACE HTTP method.

Parameters: allowTrace The new allowTrace flag

setAttribute

public void setAttribute(String name, Object value)
Set a configured property.

setBufferSize

public void setBufferSize(int bufferSize)

Deprecated:

Set the input buffer size for this Connector.

Parameters: bufferSize The new input buffer size.

setContainer

public void setContainer(Container container)
Set the Container used for processing requests received by this Connector.

Parameters: container The new Container to use

setController

public void setController(ObjectName controller)

setEmptySessionPath

public void setEmptySessionPath(boolean emptySessionPath)
Set the "empty session path" flag.

Parameters: emptySessionPath The new "empty session path" flag value

setEnableLookups

public void setEnableLookups(boolean enableLookups)
Set the "enable DNS lookups" flag.

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

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

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.

setPort

public void setPort(int port)
Set the port number on which we listen for requests.

Parameters: port The new port number

setProperty

public boolean setProperty(String name, String value)
Set a configured property.

setProtocol

public void setProtocol(String protocol)
Set the Coyote protocol which will be used by the connector.

Parameters: protocol The Coyote protocol name

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

setProxyName

public void setProxyName(String proxyName)
Set the proxy server name for this Connector.

Parameters: proxyName The new proxy server name

setProxyPort

public void setProxyPort(int proxyPort)
Set the proxy server port for this Connector.

Parameters: proxyPort The new proxy server port

setRedirectPort

public void setRedirectPort(int redirectPort)
Set the redirect port number.

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

setScheme

public void setScheme(String scheme)
Set the scheme that will be assigned to requests received through this connector.

Parameters: scheme The new scheme

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

setService

public void setService(Service service)
Set the Service with which we are associated (if any).

Parameters: service The service that owns this Engine

setURIEncoding

public void setURIEncoding(String URIEncoding)
Set the URI encoding to be used for the URI.

Parameters: URIEncoding The new URI character encoding.

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.

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.

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

start

public void start()
Begin processing requests via this Connector.

Throws: LifecycleException if a fatal startup error occurs

stop

public void stop()
Terminate processing requests via this Connector.

Throws: LifecycleException if a fatal shutdown error occurs

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