org.apache.coyote.ajp

Class AjpAprProcessor

public class AjpAprProcessor extends Object implements ActionHook

Processes HTTP requests.

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

Nested Class Summary
protected classAjpAprProcessor.SocketInputBuffer
This class is an input buffer which will read its data from an input stream.
protected classAjpAprProcessor.SocketOutputBuffer
This class is an output buffer which will write data to an output stream.
Field Summary
protected Adapteradapter
Associated adapter.
protected MessageBytesbodyBytes
Body message.
protected AjpMessagebodyMessage
Body message.
protected MessageBytescertificates
Byte chunk for certs.
protected booleanempty
Body empty flag.
protected static byte[]endMessageArray
End message array.
protected booleanendOfStream
End of stream flag.
protected AprEndpointendpoint
Associated endpoint.
protected booleanerror
Error flag.
protected booleanfinished
Finished response.
protected booleanfirst
First read.
protected static ByteBufferflushMessageBuffer
Direct buffer used for sending explicit flush message.
protected ByteBuffergetBodyMessageBuffer
Direct buffer used for sending right away a get body message.
protected char[]hostNameC
Host name (used to avoid useless B2C conversion on the host name).
protected ByteBufferinputBuffer
Direct buffer used for input.
protected static Loglog
Logger.
protected ByteBufferoutputBuffer
Direct buffer used for output.
protected intpacketSize
The socket timeout used when reading the first block of the request header.
protected static ByteBufferpongMessageBuffer
Direct buffer used for sending right away a pong message.
protected booleanreplay
Replay read.
protected Requestrequest
Request object.
protected AjpMessagerequestHeaderMessage
Header message.
protected StringrequiredSecret
Required secret.
protected Responseresponse
Response object.
protected AjpMessageresponseHeaderMessage
Message used for response header composition.
protected static StringManagersm
The string manager for this package.
protected longsocket
Socket associated with the current connection.
protected booleanstarted
State flag.
protected MessageBytestmpMB
Temp message bytes used for processing.
protected booleantomcatAuthentication
Use Tomcat authentication ?
Constructor Summary
AjpAprProcessor(int packetSize, AprEndpoint endpoint)
Method Summary
voidaction(ActionCode actionCode, Object param)
Send an action to the connector.
protected voidfinish()
Finish AJP response.
protected voidflush()
Callback to write data from the buffer.
AdaptergetAdapter()
Get the associated adapter.
RequestgetRequest()
Get the request associated with this processor.
booleangetTomcatAuthentication()
voidparseHost(MessageBytes valueMB)
Parse host.
protected voidprepareRequest()
After reading the request headers, we have to setup the request filters.
protected voidprepareResponse()
When committing the response, we have to validate the set of headers, as well as setup the response filters.
booleanprocess(long socket)
Process pipelined HTTP requests using the specified input and output streams.
protected booleanread(int n)
Read at least the specified amount of bytes, and place them in the input buffer.
protected booleanreadMessage(AjpMessage message, boolean first, boolean useAvailableData)
Read an AJP message.
protected booleanreadt(int n, boolean useAvailableData)
Read at least the specified amount of bytes, and place them in the input buffer.
booleanreceive()
Receive a chunk of data.
voidrecycle()
Recycle the processor.
voidsetAdapter(Adapter adapter)
Set the associated adapter.
voidsetRequiredSecret(String requiredSecret)
voidsetTomcatAuthentication(boolean tomcatAuthentication)

Field Detail

adapter

protected Adapter adapter
Associated adapter.

bodyBytes

protected MessageBytes bodyBytes
Body message.

bodyMessage

protected AjpMessage bodyMessage
Body message.

certificates

protected MessageBytes certificates
Byte chunk for certs.

empty

protected boolean empty
Body empty flag.

endMessageArray

protected static final byte[] endMessageArray
End message array.

endOfStream

protected boolean endOfStream
End of stream flag.

endpoint

protected AprEndpoint endpoint
Associated endpoint.

error

protected boolean error
Error flag.

finished

protected boolean finished
Finished response.

first

protected boolean first
First read.

flushMessageBuffer

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

getBodyMessageBuffer

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

hostNameC

protected char[] hostNameC
Host name (used to avoid useless B2C conversion on the host name).

inputBuffer

protected ByteBuffer inputBuffer
Direct buffer used for input.

log

protected static Log log
Logger.

outputBuffer

protected ByteBuffer outputBuffer
Direct buffer used for output.

packetSize

protected int packetSize
The socket timeout used when reading the first block of the request header.

pongMessageBuffer

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

replay

protected boolean replay
Replay read.

request

protected Request request
Request object.

requestHeaderMessage

protected AjpMessage requestHeaderMessage
Header message. Note that this header is merely the one used during the processing of the first message of a "request", so it might not be a request header. It will stay unchanged during the processing of the whole request.

requiredSecret

protected String requiredSecret
Required secret.

response

protected Response response
Response object.

responseHeaderMessage

protected AjpMessage responseHeaderMessage
Message used for response header composition.

sm

protected static StringManager sm
The string manager for this package.

socket

protected long socket
Socket associated with the current connection.

started

protected boolean started
State flag.

tmpMB

protected MessageBytes tmpMB
Temp message bytes used for processing.

tomcatAuthentication

protected boolean tomcatAuthentication
Use Tomcat authentication ?

Constructor Detail

AjpAprProcessor

public AjpAprProcessor(int packetSize, AprEndpoint endpoint)

Method Detail

action

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

Parameters: actionCode Type of the action param Action parameter

finish

protected void finish()
Finish AJP response.

flush

protected void flush()
Callback to write data from the buffer.

getAdapter

public Adapter getAdapter()
Get the associated adapter.

Returns: the associated adapter

getRequest

public Request getRequest()
Get the request associated with this processor.

Returns: The request

getTomcatAuthentication

public boolean getTomcatAuthentication()

parseHost

public void parseHost(MessageBytes valueMB)
Parse host.

prepareRequest

protected void prepareRequest()
After reading the request headers, we have to setup the request filters.

prepareResponse

protected void prepareResponse()
When committing the response, we have to validate the set of headers, as well as setup the response filters.

process

public boolean process(long socket)
Process pipelined HTTP requests using the specified input and output streams.

Throws: IOException error during an I/O operation

read

protected boolean read(int n)
Read at least the specified amount of bytes, and place them in the input buffer.

readMessage

protected boolean readMessage(AjpMessage message, boolean first, boolean useAvailableData)
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

readt

protected boolean readt(int n, boolean useAvailableData)
Read at least the specified amount of bytes, and place them in the input buffer.

receive

public boolean receive()
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

recycle

public void recycle()
Recycle the processor.

setAdapter

public void setAdapter(Adapter adapter)
Set the associated adapter.

Parameters: adapter the new adapter

setRequiredSecret

public void setRequiredSecret(String requiredSecret)

setTomcatAuthentication

public void setTomcatAuthentication(boolean tomcatAuthentication)
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.