Apache Tomcat 7.0.4

org.apache.coyote.ajp
Class AjpProcessor

java.lang.Object
  extended by org.apache.coyote.ajp.AbstractAjpProcessor
      extended by org.apache.coyote.ajp.AjpProcessor
All Implemented Interfaces:
ActionHook, Processor

public class AjpProcessor
extends AbstractAjpProcessor

Processes AJP requests.

Author:
Remy Maucherat, Henri Gomez, Dan Milstein, Keith Wannamaker, Kevin Seguin, Costin Manolache, Bill Barker

Nested Class Summary
protected  class AjpProcessor.SocketOutputBuffer
          This class is an output buffer which will write data to an output stream.
 
Nested classes/interfaces inherited from class org.apache.coyote.ajp.AbstractAjpProcessor
AbstractAjpProcessor.SocketInputBuffer
 
Field Summary
protected static byte[] endMessageArray
          End message array.
protected static byte[] flushMessageArray
          Flush message array.
protected  byte[] getBodyMessageArray
          Direct buffer used for sending right away a get body message.
protected  InputStream input
          Input stream.
protected  int keepAliveTimeout
          The number of milliseconds Tomcat will wait for a subsequent request before closing the connection.
protected  OutputStream output
          Output stream.
protected static byte[] pongMessageArray
          Direct buffer used for sending right away a pong message.
protected  SocketWrapper<Socket> socket
          Socket associated with the current connection.
 
Fields inherited from class org.apache.coyote.ajp.AbstractAjpProcessor
adapter, asyncStateMachine, bodyBytes, bodyMessage, certificates, empty, endOfStream, endpoint, error, finished, first, hostNameC, packetSize, replay, request, requestHeaderMessage, requiredSecret, response, responseHeaderMessage, sm, tmpMB, tomcatAuthentication
 
Constructor Summary
AjpProcessor(int packetSize, JIoEndpoint endpoint)
           
 
Method Summary
protected  void actionInternal(ActionCode actionCode, Object param)
          Send an action to the connector.
 AbstractEndpoint.Handler.SocketState asyncDispatch(SocketStatus status)
           
protected  void finish()
          Finish AJP response.
protected  void flush(boolean explicit)
          Callback to write data from the buffer.
 Executor getExecutor()
           
 int getKeepAliveTimeout()
           
protected  Log getLog()
           
protected  void output(byte[] src, int offset, int length)
           
 AbstractEndpoint.Handler.SocketState process(SocketWrapper<Socket> socket)
          Process pipelined HTTP requests using the specified input and output streams.
protected  boolean read(byte[] buf, int pos, int n)
          Read at least the specified amount of bytes, and place them in the input buffer.
protected  boolean readMessage(AjpMessage message)
          Read an AJP message.
 boolean receive()
          Receive a chunk of data.
protected  boolean refillReadBuffer()
          Get more request body data from the web server and store it in the internal buffer.
 void setKeepAliveTimeout(int timeout)
           
 
Methods inherited from class org.apache.coyote.ajp.AbstractAjpProcessor
action, asyncPostProcess, getAdapter, getRequest, getTomcatAuthentication, isAsync, parseHost, prepareRequest, prepareResponse, recycle, setAdapter, setRequiredSecret, setTomcatAuthentication
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

protected SocketWrapper<Socket> socket
Socket associated with the current connection.


input

protected InputStream input
Input stream.


output

protected OutputStream output
Output stream.


getBodyMessageArray

protected final byte[] getBodyMessageArray
Direct buffer used for sending right away a get body message.


pongMessageArray

protected static final byte[] pongMessageArray
Direct buffer used for sending right away a pong message.


endMessageArray

protected static final byte[] endMessageArray
End message array.


flushMessageArray

protected static final byte[] flushMessageArray
Flush message array.


keepAliveTimeout

protected int keepAliveTimeout
The number of milliseconds Tomcat will wait for a subsequent request before closing the connection. The default is the same as for Apache HTTP Server (15 000 milliseconds).

Constructor Detail

AjpProcessor

public AjpProcessor(int packetSize,
                    JIoEndpoint endpoint)
Method Detail

getLog

protected Log getLog()
Specified by:
getLog in class AbstractAjpProcessor

getKeepAliveTimeout

public int getKeepAliveTimeout()

setKeepAliveTimeout

public void setKeepAliveTimeout(int timeout)

process

public AbstractEndpoint.Handler.SocketState process(SocketWrapper<Socket> socket)
                                             throws IOException
Process pipelined HTTP requests using the specified input and output streams.

Throws:
IOException - error during an I/O operation

asyncDispatch

public AbstractEndpoint.Handler.SocketState asyncDispatch(SocketStatus status)

getExecutor

public Executor getExecutor()
Specified by:
getExecutor in interface Processor
Specified by:
getExecutor in class AbstractAjpProcessor

actionInternal

protected void actionInternal(ActionCode actionCode,
                              Object param)
Send an action to the connector.

Specified by:
actionInternal in class AbstractAjpProcessor
Parameters:
actionCode - Type of the action
param - Action parameter

output

protected void output(byte[] src,
                      int offset,
                      int length)
               throws IOException
Specified by:
output in class AbstractAjpProcessor
Throws:
IOException

finish

protected void finish()
               throws IOException
Finish AJP response.

Specified by:
finish in class AbstractAjpProcessor
Throws:
IOException

read

protected boolean read(byte[] buf,
                       int pos,
                       int n)
                throws IOException
Read at least the specified amount of bytes, and place them in the input buffer.

Throws:
IOException

receive

public boolean receive()
                throws IOException
Receive a chunk of data. Called to implement the 'special' packet in ajp13 and to receive the data after we send a GET_BODY packet

Specified by:
receive in class AbstractAjpProcessor
Throws:
IOException

refillReadBuffer

protected boolean refillReadBuffer()
                            throws IOException
Get more request body data from the web server and store it in the internal buffer.

Specified by:
refillReadBuffer in class AbstractAjpProcessor
Returns:
true if there is more data, false if not.
Throws:
IOException

readMessage

protected boolean readMessage(AjpMessage message)
                       throws IOException
Read an AJP message.

Returns:
true if the message has been read, false if the short read didn't return anything
Throws:
IOException - any other failure, including incomplete reads

flush

protected void flush(boolean explicit)
              throws IOException
Callback to write data from the buffer.

Specified by:
flush in class AbstractAjpProcessor
Throws:
IOException

Apache Tomcat 7.0.4

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