Package org.apache.coyote.ajp
Class AjpProcessor
java.lang.Object
org.apache.coyote.AbstractProcessorLight
org.apache.coyote.AbstractProcessor
org.apache.coyote.ajp.AjpProcessor
- All Implemented Interfaces:
- ActionHook,- Processor
AJP Processor implementation.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classThis class is an input buffer which will read its data from an input stream.protected classThis class is an output buffer which will write data to an output stream.
- 
Field SummaryFields inherited from class org.apache.coyote.AbstractProcessoradapter, asyncStateMachine, request, response, socketWrapper, sslSupport, userDataHelper
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected final voidack(ContinueResponseTiming continueResponseTiming) Process acknowledgment of the request.protected final intavailable(boolean doRead) Queries if bytes are available in buffers.protected final voidSwallowing bytes is required for pipelining requests, so this allows to avoid doing extra operations in case an error occurs and the connection is to be closed instead.protected AbstractEndpoint.Handler.SocketStatePerform any necessary clean-up processing if the dispatch resulted in the completion of processing for the current request.protected voidPerform any necessary processing for a non-blocking read before dispatching to the adapter.protected voidprotected final voidFinish the current response.protected final voidflush()Callback to write data from the buffer.protected booleanFlush any pending writes.protected LoggetLog()protected final booleanProcessors that populate request attributes directly (e.g.protected final booleanprotected final booleanprotected booleanvoidpause()Informs the processor that the underlying I/O layer has stopped accepting new connections.protected voidCalled when a host header is not present in the request (e.g.protected voidCalled when a host header is not present or is empty in the request (e.g.protected final voidPopulate the remote host request attribute.protected final voidPopulate the TLS related request attributes from theSSLSupportinstance associated with this processor.protected final voidWhen committing the response, we have to validate the set of headers, as well as setup the response filters.voidrecycle()Recycle the processor, ready for the next request which may be on the same connection or a different connection.protected booleanrefillReadBuffer(boolean block) Get more request body data from the web server and store it in the internal buffer.protected final voidWhen using non blocking IO, register to get a callback when polling determines that bytes are available for reading.service(SocketWrapperBase<?> socket) Service a 'standard' HTTP request.protected final voidsetRequestBody(ByteChunk body) Set the specified byte chunk as the request body that will be read.protected final voidThe response is finished and no additional bytes need to be sent to the client.Methods inherited from class org.apache.coyote.AbstractProcessorack, action, asyncPostProcess, checkAsyncTimeoutGeneration, dispatch, doHttpUpgrade, doPush, execute, executeDispatches, getAdapter, getAsyncTimeout, getConnectionID, getErrorState, getLeftoverInput, getRequest, getSocketWrapper, getStreamID, getUpgradeToken, isAsync, isPushSupported, isReadyForRead, isTrailerFieldsSupported, isUpgrade, logAccess, parseHost, processSocketEvent, setAsyncTimeout, setErrorState, setSocketWrapper, setSslSupport, sslReHandShake, timeoutAsyncMethods inherited from class org.apache.coyote.AbstractProcessorLightaddDispatch, clearDispatches, getIteratorAndClearDispatches, process
- 
Constructor Details- 
AjpProcessor
 
- 
- 
Method Details- 
flushBufferedWriteDescription copied from class:AbstractProcessorFlush any pending writes. Used during non-blocking writes to flush any remaining data from a previous incomplete write.- Specified by:
- flushBufferedWritein class- AbstractProcessor
- Returns:
- trueif data remains to be flushed at the end of method
- Throws:
- IOException- If an I/O error occurs while attempting to flush the data
 
- 
dispatchNonBlockingReadprotected void dispatchNonBlockingRead()Description copied from class:AbstractProcessorPerform any necessary processing for a non-blocking read before dispatching to the adapter.- Overrides:
- dispatchNonBlockingReadin class- AbstractProcessor
 
- 
dispatchEndRequestDescription copied from class:AbstractProcessorPerform any necessary clean-up processing if the dispatch resulted in the completion of processing for the current request.- Specified by:
- dispatchEndRequestin class- AbstractProcessor
- Returns:
- The state to return for the socket once the clean-up for the current request has completed
 
- 
serviceDescription copied from class:AbstractProcessorLightService a 'standard' HTTP request. This method is called for both new requests and for requests that have partially read the HTTP request line or HTTP headers. Once the headers have been fully read this method is not called again until there is a new HTTP request to process. Note that the request type may change during processing which may result in one or more calls toAbstractProcessorLight.dispatch(SocketEvent). Requests may be pipe-lined.- Specified by:
- servicein class- AbstractProcessorLight
- Parameters:
- socket- The connection to process
- Returns:
- The state the caller should put the socket in when this method returns
- Throws:
- IOException- If an I/O error occurs during the processing of the request
 
- 
recyclepublic void recycle()Description copied from interface:ProcessorRecycle the processor, ready for the next request which may be on the same connection or a different connection.- Specified by:
- recyclein interface- Processor
- Overrides:
- recyclein class- AbstractProcessor
 
- 
pausepublic void pause()Description copied from interface:ProcessorInforms the processor that the underlying I/O layer has stopped accepting new connections. This is primarily intended to enable processors that use multiplexed connections to prevent further 'streams' being added to an existing multiplexed connection.
- 
refillReadBufferGet more request body data from the web server and store it in the internal buffer.- Parameters:
- block-- trueif this is blocking IO
- Returns:
- trueif there is more data,- falseif not.
- Throws:
- IOException- An IO error occurred
 
- 
populateHostprotected void populateHost()Called when a host header is not present in the request (e.g. HTTP/1.0). It populates the server name with appropriate information. The source is expected to vary by protocol.The default implementation is a NO-OP. This implementation populates the server name from the local name provided by the AJP message. - Overrides:
- populateHostin class- AbstractProcessor
 
- 
populatePortprotected void populatePort()Called when a host header is not present or is empty in the request (e.g. HTTP/1.0). It populates the server port with appropriate information. The source is expected to vary by protocol.The default implementation is a NO-OP. This implementation populates the server port from the local port provided by the AJP message. - Overrides:
- populatePortin class- AbstractProcessor
 
- 
prepareResponseWhen committing the response, we have to validate the set of headers, as well as setup the response filters.- Specified by:
- prepareResponsein class- AbstractProcessor
- Throws:
- IOException- IO exception during commit
 
- 
flushDescription copied from class:AbstractProcessorCallback to write data from the buffer.- Specified by:
- flushin class- AbstractProcessor
- Throws:
- IOException- IO exception during the write
 
- 
finishResponseDescription copied from class:AbstractProcessorFinish the current response.- Specified by:
- finishResponsein class- AbstractProcessor
- Throws:
- IOException- IO exception during the write
 
- 
ackDescription copied from class:AbstractProcessorProcess acknowledgment of the request.- Specified by:
- ackin class- AbstractProcessor
- Parameters:
- continueResponseTiming- specifies when an acknowledgment should be sent
 
- 
earlyHints- Specified by:
- earlyHintsin class- AbstractProcessor
- Throws:
- IOException
 
- 
availableprotected final int available(boolean doRead) Description copied from class:AbstractProcessorQueries if bytes are available in buffers.- Specified by:
- availablein class- AbstractProcessor
- Parameters:
- doRead-- trueto perform a read when no bytes are availble
- Returns:
- the amount of bytes that are known to be available
 
- 
setRequestBodyDescription copied from class:AbstractProcessorSet the specified byte chunk as the request body that will be read. This allows saving and processing requests.- Specified by:
- setRequestBodyin class- AbstractProcessor
- Parameters:
- body- the byte chunk containing all the request bytes
 
- 
setSwallowResponseprotected final void setSwallowResponse()Description copied from class:AbstractProcessorThe response is finished and no additional bytes need to be sent to the client.- Specified by:
- setSwallowResponsein class- AbstractProcessor
 
- 
disableSwallowRequestprotected final void disableSwallowRequest()Description copied from class:AbstractProcessorSwallowing bytes is required for pipelining requests, so this allows to avoid doing extra operations in case an error occurs and the connection is to be closed instead.- Specified by:
- disableSwallowRequestin class- AbstractProcessor
 
- 
getPopulateRequestAttributesFromSocketprotected final boolean getPopulateRequestAttributesFromSocket()Description copied from class:AbstractProcessorProcessors that populate request attributes directly (e.g. AJP) should over-ride this method and returnfalse.- Overrides:
- getPopulateRequestAttributesFromSocketin class- AbstractProcessor
- Returns:
- trueif the SocketWrapper should be used to populate the request attributes, otherwise- false.
 
- 
populateRequestAttributeRemoteHostprotected final void populateRequestAttributeRemoteHost()Description copied from class:AbstractProcessorPopulate the remote host request attribute. Processors (e.g. AJP) that populate this from an alternative source should override this method.- Overrides:
- populateRequestAttributeRemoteHostin class- AbstractProcessor
 
- 
populateSslRequestAttributesprotected final void populateSslRequestAttributes()Description copied from class:AbstractProcessorPopulate the TLS related request attributes from theSSLSupportinstance associated with this processor. Protocols that populate TLS attributes from a different source (e.g. AJP) should override this method.- Overrides:
- populateSslRequestAttributesin class- AbstractProcessor
 
- 
isRequestBodyFullyReadprotected final boolean isRequestBodyFullyRead()- Specified by:
- isRequestBodyFullyReadin class- AbstractProcessor
- Returns:
- trueif it is known that the request body has been fully read
 
- 
registerReadInterestprotected final void registerReadInterest()Description copied from class:AbstractProcessorWhen using non blocking IO, register to get a callback when polling determines that bytes are available for reading.- Specified by:
- registerReadInterestin class- AbstractProcessor
 
- 
isReadyForWriteprotected final boolean isReadyForWrite()- Specified by:
- isReadyForWritein class- AbstractProcessor
- Returns:
- trueif bytes can be written without blocking
 
- 
isTrailerFieldsReadyprotected boolean isTrailerFieldsReady()- Specified by:
- isTrailerFieldsReadyin class- AbstractProcessor
 
- 
getLog- Specified by:
- getLogin class- AbstractProcessorLight
- Returns:
- the logger associated with this processor type
 
 
-