org.apache.coyote.tomcat4

Class CoyoteConnector

Implemented Interfaces:
Connector, Lifecycle, MBeanRegistration

public final class CoyoteConnector
extends java.lang.Object
implements Connector, Lifecycle, MBeanRegistration

Implementation of a Coyote connector for Tomcat 4.x.

Version:
$Revision: 1.34 $ $Date: 2004/02/24 08:54:29 $

Authors:
Craig R. McClanahan
Remy Maucherat

Field Summary

protected Container
container
The Container used for processing requests received by this Connector.
protected String
domain
protected LifecycleSupport
lifecycle
The lifecycle event support for this component.
protected int
maxSpareProcessors
The maximum amount of spare processors.
protected int
minProcessors
The minimum number of processors to start at initialization time.
protected MBeanServer
mserver
protected ObjectName
oname

Fields inherited from interface org.apache.catalina.Lifecycle

AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT

Method Summary

void
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
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.
LifecycleListener[]
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle.
int
getAcceptCount()
Return the accept count for this Connector.
String
getAddress()
Return the bind IP address for this Connector.
boolean
getAllowTrace()
True if the TRACE method is allowed.
int
getBufferSize()
Return the input buffer size for this Connector.
String
getCompression()
Get the value of compression.
int
getConnectionLinger()
Return the connection linger for this Connector.
int
getConnectionTimeout()
Return the connection timeout for this Connector.
int
getConnectionUploadTimeout()
Return the connection upload timeout for this Connector.
Container
getContainer()
Return the Container used for processing requests received by this Connector.
int
getCurProcessors()
Return the current number of processors that have been created.
int
getDebug()
Return the debugging detail level for this component.
boolean
getDisableUploadTimeout()
Return the flag that specifies upload time-out behavior.
String
getDomain()
boolean
getEnableLookups()
Return the "enable DNS lookups" flag.
ServerSocketFactory
getFactory()
Return the server socket factory used by this Container.
String
getInfo()
Return descriptive information about this Connector implementation.
int
getMaxKeepAliveRequests()
Return the maximum number of Keep-Alive requests to honor per connection.
int
getMaxProcessors()
Return the maximum number of processors allowed, or <0 for unlimited.
int
getMaxSpareProcessors()
Return the maximum number of spare processors allowed.
int
getMinProcessors()
Return the minimum number of processors to start at initialization.
ObjectName
getObjectName()
int
getPort()
Return the port number on which we listen for requests.
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.
int
getServerSocketTimeout()
Return the server socket timeout for this Connector.
Service
getService()
Return the Service with which we are associated (if any).
boolean
getTcpNoDelay()
Return the TCP no delay flag value.
boolean
getTomcatAuthentication()
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
getUseURIValidationHack()
Return the value of the Uri validation flag.
void
initialize()
Initialize this connector (create ServerSocket here!)
boolean
isAvailable()
Is this connector available for processing requests?
void
postDeregister()
void
postRegister(Boolean registrationDone)
void
preDeregister()
ObjectName
preRegister(MBeanServer server, ObjectName name)
void
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
void
setAcceptCount(int count)
Set the accept count for this Connector.
void
setAddress(String address)
Set the bind IP address for this Connector.
void
setAllowTrace(boolean allowTrace)
Set the allowTrace flag, to disable or enable the TRACE HTTP method.
void
setBufferSize(int bufferSize)
Set the input buffer size for this Connector.
void
setCompression(String compression)
Set the value of compression.
void
setConnectionLinger(int connectionLinger)
Set the connection linger for this Connector.
void
setConnectionTimeout(int connectionTimeout)
Set the connection timeout for this Connector.
void
setConnectionUploadTimeout(int connectionUploadTimeout)
Set the connection upload timeout for this Connector.
void
setContainer(Container container)
Set the Container used for processing requests received by this Connector.
void
setDebug(int debug)
Set the debugging detail level for this component.
void
setDisableUploadTimeout(boolean isDisabled)
Set the flag to specify upload time-out behavior.
void
setEnableLookups(boolean enableLookups)
Set the "enable DNS lookups" flag.
void
setFactory(ServerSocketFactory factory)
Set the server socket factory used by this Container.
void
setMaxKeepAliveRequests(int mkar)
Set the maximum number of Keep-Alive requests to honor per connection.
void
setMaxProcessors(int maxProcessors)
Set the maximum number of processors allowed, or <0 for unlimited.
void
setMaxSpareProcessors(int maxSpareProcessors)
Set the maximum number of spare processors allowed.
void
setMinProcessors(int minProcessors)
Set the minimum number of processors to start at initialization.
void
setPort(int port)
Set the port number on which we listen for requests.
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
setServerSocketTimeout(int serverSocketTimeout)
Set the server socket timeout for this Connector.
void
setService(Service service)
Set the Service with which we are associated (if any).
void
setTcpNoDelay(boolean tcpNoDelay)
Set the TCP no delay flag which will be set on the socket after accepting a connection.
void
setTomcatAuthentication(boolean tomcatAuthentication)
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
setUseURIValidationHack(boolean useURIValidationHack)
Set the value of the Uri validation flag.
void
start()
Begin processing requests via this Connector.
void
stop()
Terminate processing requests via this Connector.

Field Details

container

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


domain

protected String domain


lifecycle

protected LifecycleSupport lifecycle
The lifecycle event support for this component.


maxSpareProcessors

protected int maxSpareProcessors
The maximum amount of spare processors.


minProcessors

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


mserver

protected MBeanServer mserver


oname

protected ObjectName oname

Method Details

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


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


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.
Specified by:
findLifecycleListeners in interface Lifecycle


getAcceptCount

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


getAddress

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


getAllowTrace

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


getBufferSize

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


getCompression

public String getCompression()
Get the value of compression.


getConnectionLinger

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


getConnectionTimeout

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


getConnectionUploadTimeout

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


getContainer

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


getCurProcessors

public int getCurProcessors()
Return the current number of processors that have been created.


getDebug

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


getDisableUploadTimeout

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


getDomain

public String getDomain()


getEnableLookups

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


getFactory

public ServerSocketFactory getFactory()
Return the server socket factory used by this Container.
Specified by:
getFactory in interface Connector


getInfo

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


getMaxKeepAliveRequests

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


getMaxProcessors

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


getMaxSpareProcessors

public int getMaxSpareProcessors()
Return the maximum number of spare processors allowed.


getMinProcessors

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


getObjectName

public ObjectName getObjectName()


getPort

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


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.
Specified by:
getRedirectPort in interface Connector


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


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


getServerSocketTimeout

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


getService

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


getTcpNoDelay

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


getTomcatAuthentication

public boolean getTomcatAuthentication()


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.


getUseURIValidationHack

public boolean getUseURIValidationHack()
Return the value of the Uri validation flag.


initialize

public void initialize()
            throws LifecycleException
Initialize this connector (create ServerSocket here!)
Specified by:
initialize in interface Connector


isAvailable

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


postDeregister

public void postDeregister()


postRegister

public void postRegister(Boolean registrationDone)


preDeregister

public void preDeregister()
            throws Exception


preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
            throws Exception


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


setAcceptCount

public void setAcceptCount(int count)
Set the accept count for this Connector.

Parameters:
count - The new accept count


setAddress

public void setAddress(String address)
Set the bind IP address for this Connector.

Parameters:
address - The bind IP address


setAllowTrace

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

Parameters:
allowTrace - The new allowTrace flag


setBufferSize

public void setBufferSize(int bufferSize)
Set the input buffer size for this Connector.

Parameters:
bufferSize - The new input buffer size.


setCompression

public void setCompression(String compression)
Set the value of compression.

Parameters:
compression - The new compression value, which can be "on", "off" or "force"


setConnectionLinger

public void setConnectionLinger(int connectionLinger)
Set the connection linger for this Connector.

Parameters:


setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout)
Set the connection timeout for this Connector.

Parameters:


setConnectionUploadTimeout

public void setConnectionUploadTimeout(int connectionUploadTimeout)
Set the connection upload timeout for this Connector.

Parameters:
connectionUploadTimeout - The new connection upload timeout


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


setDebug

public void setDebug(int debug)
Set the debugging detail level for this component.

Parameters:
debug - The new debugging detail level


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.


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


setMaxKeepAliveRequests

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


setMaxProcessors

public void setMaxProcessors(int maxProcessors)
Set the maximum number of processors allowed, or <0 for unlimited.

Parameters:
maxProcessors - The new maximum processors


setMaxSpareProcessors

public void setMaxSpareProcessors(int maxSpareProcessors)
Set the maximum number of spare processors allowed.

Parameters:
maxSpareProcessors - The new maximum of spare processors


setMinProcessors

public void setMinProcessors(int minProcessors)
Set the minimum number of processors to start at initialization.

Parameters:
minProcessors - The new minimum processors


setPort

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

Parameters:
port - The new port number


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.
Specified by:
setRedirectPort in interface Connector

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.
Specified by:
setScheme in interface 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.
Specified by:
setSecure in interface Connector

Parameters:
secure - The new secure connection flag


setServerSocketTimeout

public void setServerSocketTimeout(int serverSocketTimeout)
Set the server socket timeout for this Connector.

Parameters:


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


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


setTomcatAuthentication

public void setTomcatAuthentication(boolean tomcatAuthentication)


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.


setUseURIValidationHack

public void setUseURIValidationHack(boolean useURIValidationHack)
Set the value of the Uri validation flag.

Parameters:
useURIValidationHack - The new flag value


start

public void start()
            throws LifecycleException
Begin processing requests via this Connector.
Specified by:
start in interface Lifecycle

Throws:
LifecycleException - if a fatal startup error occurs


stop

public void stop()
            throws LifecycleException
Terminate processing requests via this Connector.
Specified by:
stop in interface Lifecycle

Throws:
LifecycleException - if a fatal shutdown error occurs


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.