Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ajp.tomcat4
Class Ajp13Connector  view Ajp13Connector download Ajp13Connector.java

java.lang.Object
  extended byorg.apache.ajp.tomcat4.Ajp13Connector
All Implemented Interfaces:
org.apache.catalina.Lifecycle, java.lang.Runnable

public final class Ajp13Connector
extends java.lang.Object
implements org.apache.catalina.Lifecycle, java.lang.Runnable

Implementation of an Ajp13 connector.

Version:
$Revision: 299218 $ $Date: 2004-02-24 03:48:44 -0500 (Tue, 24 Feb 2004) $

Nested Class Summary
private  class Ajp13Connector.DebugThread
          Debugging thread used to debug thread activity in this connector.
 
Field Summary
private  int acceptCount
          The accept count for this Connector.
private  java.lang.String address
          The IP address on which to bind, if any.
private  int bufferSize
          The input buffer size we should create on input streams.
private  int connectionLinger
          Linger value to be used on socket close.
private  int connectionTimeout
          Timeout value on the incoming connection.
protected  org.apache.catalina.Container container
          The Container used for processing requests received by this Connector.
private  java.util.Vector created
          The set of processors that have ever been created.
private  int curProcessors
          The current number of processors that have been created.
private  int debug
          The debugging detail level for this component.
private  Ajp13Connector.DebugThread debugThread
          A thread that periodically logs debug info if debug > 0.
private  boolean enableLookups
          enable DNS lookups.
private  ServerSocketFactory factory
          The server socket factory for this component.
private static java.lang.String info
          Descriptive information about this Connector implementation.
protected  org.apache.catalina.util.LifecycleSupport lifecycle
          The lifecycle event support for this component.
private  Ajp13Logger logger
           
private  int maxProcessors
          The maximum number of processors allowed, or <0 for unlimited.
protected  int minProcessors
          The minimum number of processors to start at initialization time.
private  int port
          The port number on which we listen for ajp13 requests.
private  java.util.Stack processors
          The set of processors that have been created but are not currently being used to process a request.
private  int redirectPort
          redirect port.
private  java.lang.String scheme
          The request scheme that will be set on all requests received through this connector.
private  java.lang.String secret
           
private  boolean secure
          The secure connection flag that will be set on all requests received through this connector.
private  java.net.ServerSocket serverSocket
          The server socket through which we listen for incoming TCP connections.
private  org.apache.catalina.Service service
          The service which which the connector is associated
private  org.apache.catalina.util.StringManager sm
          The string manager for this package.
private  boolean started
          Has this component been started yet?
private  boolean stopped
          The shutdown signal to our background thread
private  java.lang.Thread thread
          The background thread.
private  java.lang.ThreadGroup threadGroup
          This connector's thread group.
private  java.lang.String threadName
          The name to register for the background thread.
private  java.lang.Object threadSync
          The thread synchronization object.
private  boolean tomcatAuthentication
          Tomcat authentication flag.
 
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
Ajp13Connector()
           
 
Method Summary
 void addLifecycleListener(org.apache.catalina.LifecycleListener listener)
          Add a lifecycle event listener to this component.
private  Ajp13Processor createProcessor()
          Create (or allocate) and return an available processor for use in processing a specific AJP13 request, if possible.
 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.
 org.apache.catalina.LifecycleListener[] findLifecycleListeners()
          Get the lifecycle listeners associated with this lifecycle.
 int getAcceptCount()
          Return the accept count for this Connector.
 java.lang.String getAddress()
          Return the bind IP address for this Connector.
 int getBufferSize()
          Return the input buffer size for this Connector.
 int getConnectionLinger()
          Return the connection linger settings for this Connector.
 int getConnectionTimeout()
          Return the connection timeout for this Connector.
 org.apache.catalina.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 getEnableLookups()
          Return the "enable DNS lookups" flag.
 ServerSocketFactory getFactory()
          Return the server socket factory used by this Container.
 java.lang.String getInfo()
          Return descriptive information about this Connector implementation.
 int getMaxProcessors()
          Return the maximum number of processors allowed, or <0 for unlimited.
 int getMinProcessors()
          Return the minimum number of processors to start at initialization.
 int getPort()
          Return the port number on which we listen for AJP13 requests.
 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.
 java.lang.String getSecret()
           
 boolean getSecure()
          Return the secure connection flag that will be assigned to requests received through this connector.
 org.apache.catalina.Service getService()
          Returns the Service with which we are associated.
 boolean getTomcatAuthentication()
          Get the value of the tomcatAuthentication flag.
 void initialize()
          Invoke a pre-startup initialization.
 boolean isAvailable()
          Is this connector available for processing requests?
private  Ajp13Processor newProcessor()
          Create and return a new processor suitable for processing AJP13 requests and returning the corresponding responses.
private  java.net.ServerSocket open()
          Open and return the server socket for this Connector.
(package private)  void recycle(Ajp13Processor processor)
          Recycle the specified Processor so that it can be used again.
 void removeLifecycleListener(org.apache.catalina.LifecycleListener listener)
          Remove a lifecycle event listener from this component.
 void run()
          The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.
 void setAcceptCount(int count)
          Set the accept count for this Connector.
 void setAddress(java.lang.String address)
          Set the bind IP address for this Connector.
 void setBufferSize(int bufferSize)
          Set the input buffer size for this Connector.
 void setConnectionLinger(int connectionLinger)
          Set the connection linger for this Connector.
 void setConnectionTimeout(int connectionTimeout)
          Set the connection timeout for this Connector.
 void setContainer(org.apache.catalina.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 setEnableLookups(boolean enableLookups)
          Set the "enable DNS lookups" flag.
 void setFactory(ServerSocketFactory factory)
          Set the server socket factory used by this Container.
 void setMaxProcessors(int maxProcessors)
          Set the maximum number of processors allowed, or <0 for unlimited.
 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 AJP13 requests.
 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 setSecret(java.lang.String s)
           
 void setSecure(boolean secure)
          Set the secure connection flag that will be assigned to requests received through this connector.
 void setService(org.apache.catalina.Service service)
          Set the Service with which we are associated.
 void setTomcatAuthentication(boolean tomcatAuthentication)
          Set the value of the tomcatAuthentication flag.
 void start()
          Begin processing requests via this Connector.
 void stop()
          Terminate processing requests via this Connector.
private  void threadStart()
          Start the background processing thread.
private  void threadStop()
          Stop the background processing thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

acceptCount

private int acceptCount
The accept count for this Connector.


address

private java.lang.String address
The IP address on which to bind, if any. If null, all addresses on the server will be bound.


bufferSize

private int bufferSize
The input buffer size we should create on input streams.


container

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


created

private java.util.Vector created
The set of processors that have ever been created.


curProcessors

private int curProcessors
The current number of processors that have been created.


debug

private int debug
The debugging detail level for this component.


factory

private ServerSocketFactory factory
The server socket factory for this component.


info

private static final java.lang.String info
Descriptive information about this Connector implementation.

See Also:
Constant Field Values

redirectPort

private int redirectPort
redirect port.


enableLookups

private boolean enableLookups
enable DNS lookups.


lifecycle

protected org.apache.catalina.util.LifecycleSupport lifecycle
The lifecycle event support for this component.


minProcessors

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


maxProcessors

private int maxProcessors
The maximum number of processors allowed, or <0 for unlimited.


connectionTimeout

private int connectionTimeout
Timeout value on the incoming connection. Note : a value of 0 means no timeout.


connectionLinger

private int connectionLinger
Linger value to be used on socket close. Note : a value of -1 means no linger used on close.


port

private int port
The port number on which we listen for ajp13 requests.


processors

private java.util.Stack processors
The set of processors that have been created but are not currently being used to process a request.


scheme

private java.lang.String scheme
The request scheme that will be set on all requests received through this connector.


secure

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


serverSocket

private java.net.ServerSocket serverSocket
The server socket through which we listen for incoming TCP connections.


sm

private org.apache.catalina.util.StringManager sm
The string manager for this package.


started

private boolean started
Has this component been started yet?


stopped

private boolean stopped
The shutdown signal to our background thread


thread

private java.lang.Thread thread
The background thread.


threadGroup

private java.lang.ThreadGroup threadGroup
This connector's thread group.


threadName

private java.lang.String threadName
The name to register for the background thread.


debugThread

private Ajp13Connector.DebugThread debugThread
A thread that periodically logs debug info if debug > 0.


threadSync

private java.lang.Object threadSync
The thread synchronization object.


logger

private Ajp13Logger logger

service

private org.apache.catalina.Service service
The service which which the connector is associated


secret

private java.lang.String secret

tomcatAuthentication

private boolean tomcatAuthentication
Tomcat authentication flag. If true, the authnetication is done by Tomcat, otherwise, it is done by the native webserver.

Constructor Detail

Ajp13Connector

public Ajp13Connector()
Method Detail

getConnectionTimeout

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


setConnectionTimeout

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


getConnectionLinger

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


setConnectionLinger

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


setSecret

public void setSecret(java.lang.String s)

getSecret

public java.lang.String getSecret()

getAcceptCount

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


setAcceptCount

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


getAddress

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


setAddress

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


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.


getContainer

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


setContainer

public void setContainer(org.apache.catalina.Container container)
Set the Container used for processing requests received by this 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.


setDebug

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


getEnableLookups

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


setEnableLookups

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


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.


getFactory

public ServerSocketFactory getFactory()
Return the server socket factory used by this Container.


setFactory

public void setFactory(ServerSocketFactory factory)
Set the server socket factory used by this Container.


getInfo

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


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.


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.


getPort

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


setPort

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


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.


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.


getService

public org.apache.catalina.Service getService()
Returns the Service with which we are associated.


setService

public void setService(org.apache.catalina.Service service)
Set the Service with which we are associated.


getTomcatAuthentication

public boolean getTomcatAuthentication()
Get the value of the tomcatAuthentication flag.


setTomcatAuthentication

public void setTomcatAuthentication(boolean tomcatAuthentication)
Set the value of the tomcatAuthentication flag.


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.


initialize

public void initialize()
                throws org.apache.catalina.LifecycleException
Invoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix operating environments. ServerSocket (we start as root and change user? or I miss something?).


recycle

void recycle(Ajp13Processor processor)
Recycle the specified Processor so that it can be used again.


createProcessor

private Ajp13Processor createProcessor()
Create (or allocate) and return an available processor for use in processing a specific AJP13 request, if possible. If the maximum allowed processors have already been created and are in use, return null instead.


newProcessor

private Ajp13Processor newProcessor()
Create and return a new processor suitable for processing AJP13 requests and returning the corresponding responses.


open

private java.net.ServerSocket open()
                            throws java.io.IOException
Open and return the server socket for this Connector. If an IP address has been specified, the socket will be opened only on that address; otherwise it will be opened on all addresses.


run

public void run()
The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor.

Specified by:
run in interface java.lang.Runnable

threadStart

private void threadStart()
Start the background processing thread.


threadStop

private void threadStop()
Stop the background processing thread.


addLifecycleListener

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

Specified by:
addLifecycleListener in interface org.apache.catalina.Lifecycle

findLifecycleListeners

public org.apache.catalina.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 org.apache.catalina.Lifecycle

removeLifecycleListener

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

Specified by:
removeLifecycleListener in interface org.apache.catalina.Lifecycle

start

public void start()
           throws org.apache.catalina.LifecycleException
Begin processing requests via this Connector.

Specified by:
start in interface org.apache.catalina.Lifecycle

stop

public void stop()
          throws org.apache.catalina.LifecycleException
Terminate processing requests via this Connector.

Specified by:
stop in interface org.apache.catalina.Lifecycle