org.apache.catalina.connector
Class Connector

java.lang.Object
  extended byorg.apache.catalina.connector.Connector
All Implemented Interfaces:
Lifecycle, javax.management.MBeanRegistration

public class Connector
extends java.lang.Object
implements Lifecycle, javax.management.MBeanRegistration

Implementation of a Coyote connector for Tomcat 5.x.

Version:
$Revision: 1.12 $ $Date: 2004/10/05 08:03:25 $
Author:
Craig R. McClanahan, Remy Maucherat

Field Summary
protected  Container container
          The Container used for processing requests received by this Connector.
protected  java.lang.String domain
           
protected  LifecycleSupport lifecycle
          The lifecycle event support for this component.
protected  javax.management.MBeanServer mserver
           
protected  javax.management.ObjectName oname
           
protected static java.util.HashMap replacements
           
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
Connector()
           
Connector(java.lang.String protocol)
           
 
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.
 void destroy()
           
 LifecycleListener[] findLifecycleListeners()
          Get the lifecycle listeners associated with this lifecycle.
 boolean getAllowTrace()
          True if the TRACE method is allowed.
 java.lang.Object getAttribute(java.lang.String name)
          Return a configured property.
 int getBufferSize()
          Deprecated.  
 Container getContainer()
          Return the Container used for processing requests received by this Connector.
 javax.management.ObjectName getController()
           
 java.lang.String getDomain()
           
 boolean getEnableLookups()
          Return the "enable DNS lookups" flag.
 java.lang.String getInfo()
          Return descriptive information about this Connector implementation.
 Mapper getMapper()
          Return the mapper.
 int getMaxPostSize()
          Return the maximum size of a POST which will be automatically parsed by the container.
 javax.management.ObjectName getObjectName()
           
 int getPort()
          Return the port number on which we listen for requests.
 java.lang.Object getProperty(java.lang.String name)
          Return a configured property.
 java.lang.String getProtocol()
          Return the Coyote protocol handler in use.
 ProtocolHandler getProtocolHandler()
          Return the protocol handler associated with the connector.
 java.lang.String getProtocolHandlerClassName()
          Return the class name of the Coyote protocol handler in use.
 java.lang.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.
 java.lang.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).
 java.lang.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 getXpoweredBy()
          Indicates whether the generation of an X-Powered-By response header for servlet-generated responses is enabled or disabled for this Connector.
 void init()
           
 void initialize()
          Initialize this connector (create ServerSocket here!)
 boolean isAvailable()
          Is this connector available for processing requests?
 void pause()
          Pause the connector.
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
           
 void removeLifecycleListener(LifecycleListener listener)
          Remove a lifecycle event listener from this component.
 void removeProperty(java.lang.String name)
          remove a configured property.
 void resume()
          Pause the connector.
 void setAllowTrace(boolean allowTrace)
          Set the allowTrace flag, to disable or enable the TRACE HTTP method.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set a configured property.
 void setBufferSize(int bufferSize)
          Deprecated.  
 void setContainer(Container container)
          Set the Container used for processing requests received by this Connector.
 void setController(javax.management.ObjectName controller)
           
 void setEnableLookups(boolean enableLookups)
          Set the "enable DNS lookups" flag.
 void setMaxPostSize(int maxPostSize)
          Set the maximum size of a POST which will be automatically parsed by the container.
 void setPort(int port)
          Set the port number on which we listen for requests.
 void setProperty(java.lang.String name, java.lang.String value)
          Set a configured property.
 void setProtocol(java.lang.String protocol)
          Set the Coyote protocol which will be used by the connector.
 void setProtocolHandlerClassName(java.lang.String protocolHandlerClassName)
          Set the class name of the Coyote protocol handler which will be used by the connector.
 void setProxyName(java.lang.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(java.lang.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(java.lang.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 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.
 void start()
          Begin processing requests via this Connector.
 void stop()
          Terminate processing requests via this Connector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.


replacements

protected static java.util.HashMap replacements

domain

protected java.lang.String domain

oname

protected javax.management.ObjectName oname

mserver

protected javax.management.MBeanServer mserver
Constructor Detail

Connector

public Connector()
          throws java.lang.Exception

Connector

public Connector(java.lang.String protocol)
          throws java.lang.Exception
Method Detail

getProperty

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


setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Set a configured property.


getAttribute

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


setAttribute

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


removeProperty

public void removeProperty(java.lang.String name)
remove 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

isAvailable

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


getBufferSize

public int getBufferSize()
Deprecated.  

Return the input buffer size for this Connector.


setBufferSize

public void setBufferSize(int bufferSize)
Deprecated.  

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.


setContainer

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

Parameters:
container - The new Container to use

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 java.lang.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.


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

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

getProtocol

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


setProtocol

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

Parameters:
protocol - The Coyote protocol name

getProtocolHandlerClassName

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


setProtocolHandlerClassName

public void setProtocolHandlerClassName(java.lang.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 java.lang.String getProxyName()
Return the proxy server name for this Connector.


setProxyName

public void setProxyName(java.lang.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 java.lang.String getScheme()
Return the scheme that will be assigned to requests received through this connector. Default value is "http".


setScheme

public void setScheme(java.lang.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 java.lang.String getURIEncoding()
Return the character encoding to be used for the URI.


setURIEncoding

public void setURIEncoding(java.lang.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.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

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.


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

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

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

initialize

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

Throws:
LifecycleException

pause

public void pause()
           throws LifecycleException
Pause the connector.

Throws:
LifecycleException

resume

public void resume()
            throws LifecycleException
Pause the connector.

Throws:
LifecycleException

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

getController

public javax.management.ObjectName getController()

setController

public void setController(javax.management.ObjectName controller)

getObjectName

public javax.management.ObjectName getObjectName()

getDomain

public java.lang.String getDomain()

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

init

public void init()
          throws java.lang.Exception
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Throws:
java.lang.Exception


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