Apache Tomcat 7.0.4

org.apache.coyote.ajp
Class AjpAprProcessor

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

public class AjpAprProcessor
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 AjpAprProcessor.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 ByteBuffer flushMessageBuffer
          Direct buffer used for sending explicit flush message.
protected  ByteBuffer getBodyMessageBuffer
          Direct buffer used for sending right away a get body message.
protected  ByteBuffer inputBuffer
          Direct buffer used for input.
protected  ByteBuffer outputBuffer
          Direct buffer used for output.
protected static ByteBuffer pongMessageBuffer
          Direct buffer used for sending right away a pong message.
protected  SocketWrapper<Long> 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
AjpAprProcessor(int packetSize, AprEndpoint endpoint)
           
 
Method Summary
protected  void actionInternal(ActionCode actionCode, Object param)
          Send an action to the connector.
 AbstractEndpoint.Handler.SocketState asyncDispatch(SocketWrapper<Long> socket, SocketStatus status)
           
protected  void finish()
          Finish AJP response.
protected  void flush(boolean explicit)
          Callback to write data from the buffer.
 Executor getExecutor()
           
protected  Log getLog()
           
protected  void output(byte[] src, int offset, int length)
           
 AbstractEndpoint.Handler.SocketState process(SocketWrapper<Long> socket)
          Process pipelined HTTP requests using the specified input and output streams.
protected  boolean read(int n)
          Read at least the specified amount of bytes, and place them in the input buffer.
protected  boolean readMessage(AjpMessage message, boolean first, boolean useAvailableData)
          Read an AJP message.
protected  boolean readt(int n, boolean useAvailableData)
          Read at least the specified amount of bytes, and place them in the input buffer.
 boolean receive()
          Receive a chunk of data.
 void recycle()
          Recycle the processor.
protected  boolean refillReadBuffer()
          Get more request body data from the web server and store it in the internal buffer.
 
Methods inherited from class org.apache.coyote.ajp.AbstractAjpProcessor
action, asyncPostProcess, getAdapter, getRequest, getTomcatAuthentication, isAsync, parseHost, prepareRequest, prepareResponse, 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<Long> socket
Socket associated with the current connection.


inputBuffer

protected ByteBuffer inputBuffer
Direct buffer used for input.


outputBuffer

protected ByteBuffer outputBuffer
Direct buffer used for output.


getBodyMessageBuffer

protected final ByteBuffer getBodyMessageBuffer
Direct buffer used for sending right away a get body message.


pongMessageBuffer

protected static final ByteBuffer pongMessageBuffer
Direct buffer used for sending right away a pong message.


endMessageArray

protected static final byte[] endMessageArray
End message array.


flushMessageBuffer

protected static final ByteBuffer flushMessageBuffer
Direct buffer used for sending explicit flush message.

Constructor Detail

AjpAprProcessor

public AjpAprProcessor(int packetSize,
                       AprEndpoint endpoint)
Method Detail

getLog

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

process

public AbstractEndpoint.Handler.SocketState process(SocketWrapper<Long> 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(SocketWrapper<Long> socket,
                                                          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(int n)
                throws IOException
Read at least the specified amount of bytes, and place them in the input buffer.

Throws:
IOException

readt

protected boolean readt(int n,
                        boolean useAvailableData)
                 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,
                              boolean first,
                              boolean useAvailableData)
                       throws IOException
Read an AJP message.

Parameters:
first - is true if the message is the first in the request, which will cause a short duration blocking read
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

recycle

public void recycle()
Recycle the processor.

Overrides:
recycle in class AbstractAjpProcessor

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.