## org.mortbay.http.ajp
Class AJP13Listener

    java.lang.Object
      |
      +--org.mortbay.util.ThreadPool
            |
            +--org.mortbay.util.ThreadedServer
                  |
                  +--org.mortbay.http.ajp.AJP13Listener

All Implemented Interfaces:
  HttpListener, LifeCycle, java.io.Serializable

public class AJP13Listener
extends ThreadedServer
implements HttpListener

AJP 1.3 Protocol Listener. This listener takes requests from the mod_jk or mod_jk2 modules used by web servers such as apache and IIS to forward requests to a servlet container.

This code uses the AJP13 code from tomcat3.3 as the protocol specification, but is new implementation.

Version:
  $Id: AJP13Listener.java,v 1.14.2.1 2003/10/16 06:45:26 gregwilkins Exp $
Author:
  Greg Wilkins (gregw)
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class org.mortbay.util.ThreadPool
`ThreadPool.PoolThread`

Field Summary

Fields inherited from class org.mortbay.util.ThreadPool
`__DAEMON, __PRIORITY`

Fields inherited from interface org.mortbay.http.HttpListener
`ATTRIBUTE`

Constructor Summary
`AJP13Listener()`
`AJP13Listener(InetAddrPort address)`

Method Summary
`void` `customizeRequest(HttpConnection connection, HttpRequest request)` Customize the request from connection.
`int` `getBufferReserve()` Get the size of the header reserve area.
`int` `getBufferSize()` Get the size of the buffers used by connections from this listener.
`int` `getConfidentialPort()` Get the protocol port to use for confidential redirections.
`java.lang.String` `getConfidentialScheme()` Get the protocol scheme to use for confidential redirections.
`java.lang.String` `getDefaultScheme()` Get the default scheme for requests.
`HttpServer` `getHttpServer()` Get the HttpServer instance for this HttpListener.
`boolean` `getIdentifyListener()`
`int` `getIntegralPort()` Get the protocol port to use for integral redirections.
`java.lang.String` `getIntegralScheme()` Get the protocol scheme to use for integral redirections.
`java.lang.String[]` `getRemoteServers()`
`void` `handleConnection(java.net.Socket socket)` Handle Job.
`boolean` `isConfidential(HttpConnection connection)` Get the confidential status of a connection.
`boolean` `isIntegral(HttpConnection connection)` Get the integral status of a connection.
`boolean` `isLowOnResources()` Get the low on resources state of the listener.
`boolean` `isOutOfResources()` Get the out of resources state of the listener.
`void` `persistConnection(HttpConnection connection)` Persist the connection.
`void` `setBufferReserve(int size)`
`void` `setBufferSize(int size)`
`void` `setConfidentialPort(int confidentialPort)`
`void` `setConfidentialScheme(java.lang.String confidentialScheme)`
`void` `setHttpServer(HttpServer server)` Set the HttpServer instance for this HttpListener.
`void` `setIdentifyListener(boolean identifyListener)`
`void` `setIntegralPort(int integralPort)`
`void` `setIntegralScheme(java.lang.String integralScheme)`
`void` `setRemoteServers(java.lang.String[] servers)` Set accepted remote servers.
`void` `start()` Start the LifeCycle.
`void` `stop()` Stop the LifeCycle.

Methods inherited from class org.mortbay.util.ThreadedServer
`getHost, getInetAddress, getInetAddrPort, getLingerTimeSecs, getMaxReadTimeMs, getPort, getServerSocket, handle, open, setHost, setInetAddress, setInetAddrPort, setLingerTimeSecs, setMaxReadTimeMs, setPort, toString`

Methods inherited from class org.mortbay.util.ThreadPool
`getIdleThreads, getMaxIdleTimeMs, getMaxThreads, getMinThreads, getName, getPoolName, getThreads, getThreadsPriority, isDaemon, isStarted, join, run, setDaemon, setMaxIdleTimeMs, setMaxStopTimeMs, setMaxThreads, setMinThreads, setName, setPoolName, setThreadsPriority, shrink`

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

Methods inherited from interface org.mortbay.http.HttpListener
`getHost, getPort, setHost, setPort`

Methods inherited from interface org.mortbay.util.LifeCycle
`isStarted`

Constructor Detail

### AJP13Listener

    public AJP13Listener()

### AJP13Listener

    public AJP13Listener(InetAddrPort address)

Method Detail

### setHttpServer

    public void setHttpServer(HttpServer server)

  Description copied from interface: `HttpListener`
  Set the HttpServer instance for this HttpListener. This method is called by the HttpServer.addListener method. It should not be called directly.

  Specified by:
    `setHttpServer` in interface `HttpListener`
  Parameters:
    `server` - The HttpServer instance this HttpListener has been added to.

### getHttpServer

    public HttpServer getHttpServer()

  Description copied from interface: `HttpListener`
  Get the HttpServer instance for this HttpListener.

  Specified by:
    `getHttpServer` in interface `HttpListener`
  Returns:
    The HttpServer instance this HttpListener has been added to, or null if the listener is not added to any HttpServer.

### getBufferSize

    public int getBufferSize()

  Description copied from interface: `HttpListener`
  Get the size of the buffers used by connections from this listener.

  Specified by:
    `getBufferSize` in interface `HttpListener`
  Returns:
    The default buffer size in bytes.

### setBufferSize

    public void setBufferSize(int size)

### getBufferReserve

    public int getBufferReserve()

  Description copied from interface: `HttpListener`
  Get the size of the header reserve area. Get the size of the header reserve area within the buffers used by connections from this listener. The header reserve is space reserved in the first buffer of a response to allow a HTTP header to be written in the same packet. The reserve should be large enough to avoid moving data to fit the header, but not too large as to waste memory.

  Specified by:
    `getBufferReserve` in interface `HttpListener`
  Returns:
    The default buffer reserve size in bytes.

### setBufferReserve

    public void setBufferReserve(int size)

### getIdentifyListener

    public boolean getIdentifyListener()

### setIdentifyListener

    public void setIdentifyListener(boolean identifyListener)

  Parameters:
    `identifyListener` - If true, the listener name is added to all requests as the org.mortbay.http.HttListener attribute

### getDefaultScheme

    public java.lang.String getDefaultScheme()

  Description copied from interface: `HttpListener`
  Get the default scheme for requests. If a request is received from a HttpConnection created by this listener, that does not include a scheme in it's request URL, then this method is used to determine the protocol scheme most likely used to connect to this listener.

  Specified by:
    `getDefaultScheme` in interface `HttpListener`
  Returns:
    The protocol scheme name (eg "http" or "https").

### start

    public void start()
               throws java.lang.Exception

  Description copied from interface: `LifeCycle`
  Start the LifeCycle.

  Specified by:
    `start` in interface `LifeCycle`
  Overrides:
    `start` in class `ThreadedServer`
  Throws:
    `java.lang.Exception` - An arbitrary exception may be thrown.

### stop

    public void stop()
              throws java.lang.InterruptedException

  Description copied from interface: `LifeCycle`
  Stop the LifeCycle. The LifeCycle may wait for current activities to complete normally, but it can be interrupted.

  Specified by:
    `stop` in interface `LifeCycle`
  Overrides:
    `stop` in class `ThreadedServer`
  Throws:
    `java.lang.InterruptedException` - Stopping a lifecycle is rarely atomic and may be interrupted by another thread. If this happens InterruptedException is throw and the component will be in an indeterminant state and should probably be discarded.

### getRemoteServers

    public java.lang.String[] getRemoteServers()

  Returns:
    Array of accepted remote server hostnames or IPs.

### setRemoteServers

    public void setRemoteServers(java.lang.String[] servers)

  Set accepted remote servers. The AJP13 protocol is not secure and contains no authentication. If remote servers are set, then this listener will only accept connections from hosts with matching addresses or hostnames.

  Parameters:
    `servers` - Array of accepted remote server hostnames or IPs

### handleConnection

    public void handleConnection(java.net.Socket socket)
                          throws java.io.IOException

  Handle Job. Implementation of ThreadPool.handle(), calls handleConnection.

  Overrides:
    `handleConnection` in class `ThreadedServer`
  Parameters:
    `socket` - A Connection.
    `java.io.IOException`

### customizeRequest

    public void customizeRequest(HttpConnection connection,
                                 HttpRequest request)

  Customize the request from connection. This method extracts the socket from the connection and calls the customizeRequest(Socket,HttpRequest) method.

  Specified by:
    `customizeRequest` in interface `HttpListener`
  Parameters:
    `request` -
    `connection` - The connection the request was received on, which must be a HttpConnection created by this listener.

### persistConnection

    public void persistConnection(HttpConnection connection)

  Persist the connection.

  Specified by:
    `persistConnection` in interface `HttpListener`
  Parameters:
    `connection` -

### isLowOnResources

    public boolean isLowOnResources()

  Description copied from interface: `HttpListener`
  Get the low on resources state of the listener. For most implementations, Threads are the resource reported on by this method.

  Specified by:
    `isLowOnResources` in interface `HttpListener`
  Returns:
    True if low on idle threads.

### isOutOfResources

    public boolean isOutOfResources()

  Description copied from interface: `HttpListener`
  Get the out of resources state of the listener. For most implementations, Threads are the resource reported on by this method.

  Specified by:
    `isOutOfResources` in interface `HttpListener`
  Returns:
    True if out of resources.

### isIntegral

    public boolean isIntegral(HttpConnection connection)

  Description copied from interface: `HttpListener`
  Get the integral status of a connection.

  Specified by:
    `isIntegral` in interface `HttpListener`
  Parameters:
    `connection` - The connection to test.
  Returns:
    True of the connection checks the integrity of the data. For most implementations this is true for https connections.

### isConfidential

    public boolean isConfidential(HttpConnection connection)

  Description copied from interface: `HttpListener`
  Get the confidential status of a connection.

  Specified by:
    `isConfidential` in interface `HttpListener`
  Parameters:
    `connection` - The connection to test.
  Returns:
    True of the connection checks the integrity of the data. For most implementations this is true for https connections.

### getIntegralScheme

    public java.lang.String getIntegralScheme()

  Description copied from interface: `HttpListener`
  Get the protocol scheme to use for integral redirections. If an INTEGRAL security constraint is not met for a request, the request is redirected to an integral port. This scheme return by this method is used for that redirection.

  Specified by:
    `getIntegralScheme` in interface `HttpListener`
  Returns:
    The integral scheme. For most implementations this is "https"

### setIntegralScheme

    public void setIntegralScheme(java.lang.String integralScheme)

### getIntegralPort

    public int getIntegralPort()

  Description copied from interface: `HttpListener`
  Get the protocol port to use for integral redirections. If an INTEGRAL security constraint is not met for a request, the request is redirected to an integral port. This port return by this method is used for that redirection.

  Specified by:
    `getIntegralPort` in interface `HttpListener`
  Returns:
    The integral port. For most implementations this is 443 for https

### setIntegralPort

    public void setIntegralPort(int integralPort)

### getConfidentialScheme

    public java.lang.String getConfidentialScheme()

  Description copied from interface: `HttpListener`
  Get the protocol scheme to use for confidential redirections. If an CONFIDENTIAL security constraint is not met for a request, the request is redirected to an confidential port. This scheme return by this method is used for that redirection.

  Specified by:
    `getConfidentialScheme` in interface `HttpListener`
  Returns:
    The confidential scheme. For most implementations this is "https"

### setConfidentialScheme

    public void setConfidentialScheme(java.lang.String confidentialScheme)

### getConfidentialPort

    public int getConfidentialPort()

  Description copied from interface: `HttpListener`
  Get the protocol port to use for confidential redirections. If an CONFIDENTIAL security constraint is not met for a request, the request is redirected to an confidential port. This port return by this method is used for that redirection.

  Specified by:
    `getConfidentialPort` in interface `HttpListener`
  Returns:
    The confidential port. For most implementations this is 443 for https

### setConfidentialPort

    public void setConfidentialPort(int confidentialPort)

Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.