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 Summary
Nested 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 Summary
FieldsFields inherited from class org.apache.coyote.AbstractProcessor
adapter, asyncStateMachine, endpoint, hostNameC, request, response, socketWrapper, sslSupport, userDataHelper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidack(ContinueResponseTiming continueResponseTiming) protected final intavailable(boolean doRead) protected final voidprotected 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 final voidFinish AJP response.protected final voidflush()Callback to write data from the buffer.protected booleanFlush any pending writes.booleanintprotected LoggetLog()protected final booleanProcessors that populate request attributes directly (e.g.booleanbooleanprotected final booleanprotected final 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 voidservice(SocketWrapperBase<?> socket) Service a 'standard' HTTP request.voidsetAjpFlush(boolean ajpFlush) voidsetAllowedRequestAttributesPattern(Pattern allowedRequestAttributesPattern) voidsetClientCertProvider(String clientCertProvider) voidsetKeepAliveTimeout(int timeout) protected final voidsetRequestBody(ByteChunk body) voidsetRequiredSecret(String requiredSecret) Deprecated.voidprotected final voidvoidsetTomcatAuthentication(boolean tomcatAuthentication) voidsetTomcatAuthorization(boolean tomcatAuthorization) Methods inherited from class org.apache.coyote.AbstractProcessor
ack, action, asyncPostProcess, checkAsyncTimeoutGeneration, dispatch, doHttpUpgrade, doPush, executeDispatches, getAdapter, getAsyncTimeout, getConnectionID, getErrorState, getExecutor, getLeftoverInput, getRequest, getSocketWrapper, getStreamID, getUpgradeToken, isAsync, isPushSupported, isReadyForRead, isUpgrade, logAccess, parseHost, processSocketEvent, setAdapter, setAsyncTimeout, setErrorState, setSocketWrapper, setSslSupport, sslReHandShake, timeoutAsyncMethods inherited from class org.apache.coyote.AbstractProcessorLight
addDispatch, clearDispatches, getIteratorAndClearDispatches, process
-
Field Details
-
ajpFlush
protected boolean ajpFlushSend AJP flush packet when flushing. An flush packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and mod_proxy_ajp interprete this as a request to flush data to the client. AJP always does flush at the and of the response, so if it is not important, that the packets get streamed up to the client, do not use extra flush packets. For compatibility and to stay on the safe side, flush packets are enabled by default.
-
-
Constructor Details
-
AjpProcessor
-
-
Method Details
-
getAjpFlush
public boolean getAjpFlush() -
setAjpFlush
public void setAjpFlush(boolean ajpFlush) -
getKeepAliveTimeout
public int getKeepAliveTimeout() -
setKeepAliveTimeout
public void setKeepAliveTimeout(int timeout) -
getTomcatAuthentication
public boolean getTomcatAuthentication() -
setTomcatAuthentication
public void setTomcatAuthentication(boolean tomcatAuthentication) -
getTomcatAuthorization
public boolean getTomcatAuthorization() -
setTomcatAuthorization
public void setTomcatAuthorization(boolean tomcatAuthorization) -
setRequiredSecret
Deprecated. -
setSecret
-
getClientCertProvider
-
setClientCertProvider
-
setAllowedRequestAttributesPattern
-
flushBufferedWrite
Description 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 classAbstractProcessor- 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
-
dispatchNonBlockingRead
protected void dispatchNonBlockingRead()Description copied from class:AbstractProcessorPerform any necessary processing for a non-blocking read before dispatching to the adapter.- Overrides:
dispatchNonBlockingReadin classAbstractProcessor
-
dispatchEndRequest
Description 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 classAbstractProcessor- Returns:
- The state to return for the socket once the clean-up for the current request has completed
-
service
Description 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 classAbstractProcessorLight- 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
-
recycle
public 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 interfaceProcessor- Overrides:
recyclein classAbstractProcessor
-
pause
public 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. -
refillReadBuffer
Get 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
-
populateHost
protected 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 classAbstractProcessor
-
populatePort
protected 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 classAbstractProcessor
-
prepareResponse
When committing the response, we have to validate the set of headers, as well as setup the response filters.- Specified by:
prepareResponsein classAbstractProcessor- Throws:
IOException
-
flush
Callback to write data from the buffer.- Specified by:
flushin classAbstractProcessor- Throws:
IOException
-
finishResponse
Finish AJP response.- Specified by:
finishResponsein classAbstractProcessor- Throws:
IOException
-
ack
- Specified by:
ackin classAbstractProcessor
-
available
protected final int available(boolean doRead) - Specified by:
availablein classAbstractProcessor
-
setRequestBody
- Specified by:
setRequestBodyin classAbstractProcessor
-
setSwallowResponse
protected final void setSwallowResponse()- Specified by:
setSwallowResponsein classAbstractProcessor
-
disableSwallowRequest
protected final void disableSwallowRequest()- Specified by:
disableSwallowRequestin classAbstractProcessor
-
getPopulateRequestAttributesFromSocket
protected 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 classAbstractProcessor- Returns:
trueif the SocketWrapper should be used to populate the request attributes, otherwisefalse.
-
populateRequestAttributeRemoteHost
protected 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 classAbstractProcessor
-
populateSslRequestAttributes
protected 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 classAbstractProcessor
-
isRequestBodyFullyRead
protected final boolean isRequestBodyFullyRead()- Specified by:
isRequestBodyFullyReadin classAbstractProcessor
-
registerReadInterest
protected final void registerReadInterest()- Specified by:
registerReadInterestin classAbstractProcessor
-
isReadyForWrite
protected final boolean isReadyForWrite()- Specified by:
isReadyForWritein classAbstractProcessor
-
getLog
- Specified by:
getLogin classAbstractProcessorLight
-