Package org.apache.coyote.http11
Class Http11Processor
- java.lang.Object
- 
- org.apache.coyote.AbstractProcessorLight
- 
- org.apache.coyote.AbstractProcessor
- 
- org.apache.coyote.http11.Http11Processor
 
 
 
- 
- All Implemented Interfaces:
- ActionHook,- Processor
 
 public class Http11Processor extends AbstractProcessor 
- 
- 
Field SummaryFields Modifier and Type Field Description protected intconnectionUploadTimeoutMaximum timeout on uploads. 5 minutes as in Apache HTTPD server.protected booleancontentDelimitationContent delimiter for the request (if false, the connection will be closed at the end of the request).protected booleandisableUploadTimeoutFlag to disable setting a different time-out on uploads.protected booleanhttp09HTTP/0.9 flag.protected booleanhttp11HTTP/1.1 flag.protected Http11InputBufferinputBufferInput.protected booleankeepAliveKeep-alive.protected intmaxKeepAliveRequestsMaximum number of Keep-Alive requests to honor.protected intmaxSavePostSizeMax saved post size.protected booleanopenSocketFlag used to indicate that the socket should be kept open (e.g. for keep alive or send file).protected Http11OutputBufferoutputBufferOutput.protected booleanreadCompleteFlag that indicates if the request headers have been completely read.protected java.util.regex.PatternrestrictedUserAgentsRegular expression that defines the restricted user agents.protected SendfileDataBasesendfileDataSendfile data.protected UpgradeTokenupgradeTokenInstance of the new protocol to use after the HTTP connection has been upgraded.- 
Fields inherited from class org.apache.coyote.AbstractProcessoradapter, asyncStateMachine, endpoint, hostNameC, request, response, socketWrapper, sslSupport, userDataHelper
 
- 
 - 
Constructor SummaryConstructors Constructor Description Http11Processor(AbstractHttp11Protocol<?> protocol, AbstractEndpoint<?,?> endpoint)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidack()protected voidack(ContinueResponseTiming continueResponseTiming)protected intavailable(boolean doRead)protected voiddisableSwallowRequest()protected AbstractEndpoint.Handler.SocketStatedispatchEndRequest()Perform any necessary clean-up processing if the dispatch resulted in the completion of processing for the current request.protected voiddoHttpUpgrade(UpgradeToken upgradeToken)Process an HTTP upgrade.protected voidfinishResponse()protected voidflush()protected booleanflushBufferedWrite()Flush any pending writes.java.lang.StringgetCompression()Deprecated.intgetConnectionUploadTimeout()Get the upload timeout.booleangetDisableUploadTimeout()Get the flag that controls upload time-outs.java.nio.ByteBuffergetLeftoverInput()Allows retrieving additional input during the upgrade process.protected LoggetLog()intgetMaxKeepAliveRequests()Get the maximum number of Keep-Alive requests allowed.intgetMaxSavePostSize()Return the maximum size of a POST which will be buffered in SSL mode.UpgradeTokengetUpgradeToken()Generate an upgrade token.protected booleanisReadyForWrite()protected booleanisRequestBodyFullyRead()booleanisUpgrade()Processors that implement HTTP upgrade must override this method.voidpause()Informs the processor that the underlying I/O layer has stopped accepting new connections.protected voidpopulatePort()Called when a host header is not present or is empty in the request (e.g.protected voidprepareResponse()When 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 voidregisterReadInterest()AbstractEndpoint.Handler.SocketStateservice(SocketWrapperBase<?> socketWrapper)Service a 'standard' HTTP request.voidsetCompressableMimeTypes(java.lang.String[] compressibleMimeTypes)Deprecated.voidsetCompressibleMimeTypes(java.lang.String[] compressibleMimeTypes)Deprecated.voidsetCompression(java.lang.String compression)Deprecated.voidsetCompressionMinSize(int compressionMinSize)Deprecated.voidsetConnectionUploadTimeout(int timeout)Set the upload timeout.voidsetDisableUploadTimeout(boolean isDisabled)Set the flag to control whether a separate connection timeout is used during upload of a request body.voidsetMaxKeepAliveRequests(int mkar)Set the maximum number of Keep-Alive requests to allow.voidsetMaxSavePostSize(int msps)Set the maximum size of a POST which will be buffered in SSL mode.voidsetNoCompressionUserAgents(java.lang.String noCompressionUserAgents)Deprecated.protected voidsetRequestBody(ByteChunk body)voidsetRestrictedUserAgents(java.lang.String restrictedUserAgents)Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode).voidsetServer(java.lang.String server)Deprecated.voidsetServerRemoveAppProvidedValues(boolean serverRemoveAppProvidedValues)Deprecated.protected voidsetSocketWrapper(SocketWrapperBase<?> socketWrapper)Set the socket wrapper being used.protected voidsetSwallowResponse()protected voidsslReHandShake()Processors that can perform a TLS re-handshake (e.g.- 
Methods inherited from class org.apache.coyote.AbstractProcessoraction, asyncPostProcess, checkAsyncTimeoutGeneration, dispatch, dispatchNonBlockingRead, doPush, executeDispatches, getAdapter, getAsyncTimeout, getConnectionID, getErrorState, getExecutor, getPopulateRequestAttributesFromSocket, getRequest, getSocketWrapper, getStreamID, isAsync, isPushSupported, isReadyForRead, logAccess, parseHost, populateHost, populateRequestAttributeRemoteHost, populateSslRequestAttributes, processSocketEvent, setAdapter, setAsyncTimeout, setErrorState, setSslSupport, timeoutAsync
 - 
Methods inherited from class org.apache.coyote.AbstractProcessorLightaddDispatch, clearDispatches, getIteratorAndClearDispatches, process
 
- 
 
- 
- 
- 
Field Detail- 
inputBufferprotected final Http11InputBuffer inputBuffer Input.
 - 
outputBufferprotected final Http11OutputBuffer outputBuffer Output.
 - 
keepAliveprotected volatile boolean keepAlive Keep-alive.
 - 
openSocketprotected volatile boolean openSocket Flag used to indicate that the socket should be kept open (e.g. for keep alive or send file).
 - 
readCompleteprotected volatile boolean readComplete Flag that indicates if the request headers have been completely read.
 - 
http11protected boolean http11 HTTP/1.1 flag.
 - 
http09protected boolean http09 HTTP/0.9 flag.
 - 
contentDelimitationprotected boolean contentDelimitation Content delimiter for the request (if false, the connection will be closed at the end of the request).
 - 
restrictedUserAgentsprotected java.util.regex.Pattern restrictedUserAgents Regular expression that defines the restricted user agents.
 - 
maxKeepAliveRequestsprotected int maxKeepAliveRequests Maximum number of Keep-Alive requests to honor.
 - 
connectionUploadTimeoutprotected int connectionUploadTimeout Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.
 - 
disableUploadTimeoutprotected boolean disableUploadTimeout Flag to disable setting a different time-out on uploads.
 - 
maxSavePostSizeprotected int maxSavePostSize Max saved post size.
 - 
upgradeTokenprotected UpgradeToken upgradeToken Instance of the new protocol to use after the HTTP connection has been upgraded.
 - 
sendfileDataprotected SendfileDataBase sendfileData Sendfile data.
 
- 
 - 
Constructor Detail- 
Http11Processorpublic Http11Processor(AbstractHttp11Protocol<?> protocol, AbstractEndpoint<?,?> endpoint) 
 
- 
 - 
Method Detail- 
setCompression@Deprecated public void setCompression(java.lang.String compression) Deprecated.Set compression level.- Parameters:
- compression- One of- on,- force,- offor the minimum compression size in bytes which implies- on
 
 - 
setCompressionMinSize@Deprecated public void setCompressionMinSize(int compressionMinSize) Deprecated.Set Minimum size to trigger compression.- Parameters:
- compressionMinSize- The minimum content length required for compression in bytes
 
 - 
setNoCompressionUserAgents@Deprecated public void setNoCompressionUserAgents(java.lang.String noCompressionUserAgents) Deprecated.Set no compression user agent pattern. Regular expression as supported byPattern. e.g.:gorilla|desesplorer|tigrus.- Parameters:
- noCompressionUserAgents- The regular expression for user agent strings for which compression should not be applied
 
 - 
setCompressableMimeTypes@Deprecated public void setCompressableMimeTypes(java.lang.String[] compressibleMimeTypes) Deprecated.- Parameters:
- compressibleMimeTypes- See- setCompressibleMimeTypes(String[])
 
 - 
setCompressibleMimeTypes@Deprecated public void setCompressibleMimeTypes(java.lang.String[] compressibleMimeTypes) Deprecated.Set compressible mime-type list.- Parameters:
- compressibleMimeTypes- MIME types for which compression should be enabled
 
 - 
getCompression@Deprecated public java.lang.String getCompression() Deprecated.Return compression level.- Returns:
- The current compression level in string form (off/on/force)
 
 - 
setRestrictedUserAgentspublic void setRestrictedUserAgents(java.lang.String restrictedUserAgents) Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode). Regular expression as supported byPattern.- Parameters:
- restrictedUserAgents- The regular expression as supported by- Patternfor the user agents e.g. "gorilla|desesplorer|tigrus"
 
 - 
setMaxKeepAliveRequestspublic void setMaxKeepAliveRequests(int mkar) Set the maximum number of Keep-Alive requests to allow. This is to safeguard from DoS attacks. Setting to a negative value disables the limit.- Parameters:
- mkar- The new maximum number of Keep-Alive requests allowed
 
 - 
getMaxKeepAliveRequestspublic int getMaxKeepAliveRequests() Get the maximum number of Keep-Alive requests allowed. A negative value means there is no limit.- Returns:
- the number of Keep-Alive requests that we will allow.
 
 - 
setMaxSavePostSizepublic void setMaxSavePostSize(int msps) Set the maximum size of a POST which will be buffered in SSL mode. When a POST is received where the security constraints require a client certificate, the POST body needs to be buffered while an SSL handshake takes place to obtain the certificate.- Parameters:
- msps- The maximum size POST body to buffer in bytes
 
 - 
getMaxSavePostSizepublic int getMaxSavePostSize() Return the maximum size of a POST which will be buffered in SSL mode.- Returns:
- The size in bytes
 
 - 
setDisableUploadTimeoutpublic void setDisableUploadTimeout(boolean isDisabled) Set the flag to control whether a separate connection timeout is used during upload of a request body.- Parameters:
- isDisabled-- trueif the separate upload timeout should be disabled
 
 - 
getDisableUploadTimeoutpublic boolean getDisableUploadTimeout() Get the flag that controls upload time-outs.- Returns:
- trueif the separate upload timeout is disabled
 
 - 
setConnectionUploadTimeoutpublic void setConnectionUploadTimeout(int timeout) Set the upload timeout.- Parameters:
- timeout- Upload timeout in milliseconds
 
 - 
getConnectionUploadTimeoutpublic int getConnectionUploadTimeout() Get the upload timeout.- Returns:
- Upload timeout in milliseconds
 
 - 
setServer@Deprecated public void setServer(java.lang.String server) Deprecated.Set the server header name.- Parameters:
- server- The new value to use for the server header
 
 - 
setServerRemoveAppProvidedValues@Deprecated public void setServerRemoveAppProvidedValues(boolean serverRemoveAppProvidedValues) Deprecated.
 - 
servicepublic AbstractEndpoint.Handler.SocketState service(SocketWrapperBase<?> socketWrapper) throws java.io.IOException 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 class- AbstractProcessorLight
- Parameters:
- socketWrapper- The connection to process
- Returns:
- The state the caller should put the socket in when this method returns
- Throws:
- java.io.IOException- If an I/O error occurs during the processing of the request
 
 - 
setSocketWrapperprotected final void setSocketWrapper(SocketWrapperBase<?> socketWrapper) Description copied from class:AbstractProcessorSet the socket wrapper being used.- Overrides:
- setSocketWrapperin class- AbstractProcessor
- Parameters:
- socketWrapper- The socket wrapper
 
 - 
prepareResponseprotected final void prepareResponse() throws java.io.IOExceptionWhen committing the response, we have to validate the set of headers, as well as setup the response filters.- Specified by:
- prepareResponsein class- AbstractProcessor
- Throws:
- java.io.IOException
 
 - 
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 provides the server port from the local port. - Overrides:
- populatePortin class- AbstractProcessor
 
 - 
flushBufferedWriteprotected boolean flushBufferedWrite() throws java.io.IOExceptionDescription 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:
- java.io.IOException- If an I/O error occurs while attempting to flush the data
 
 - 
dispatchEndRequestprotected AbstractEndpoint.Handler.SocketState 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 class- AbstractProcessor
- Returns:
- The state to return for the socket once the clean-up for the current request has completed
 
 - 
getLogprotected Log getLog() - Specified by:
- getLogin class- AbstractProcessorLight
 
 - 
finishResponseprotected final void finishResponse() throws java.io.IOException- Specified by:
- finishResponsein class- AbstractProcessor
- Throws:
- java.io.IOException
 
 - 
ackprotected final void ack() - Overrides:
- ackin class- AbstractProcessor
 
 - 
ackprotected final void ack(ContinueResponseTiming continueResponseTiming) - Specified by:
- ackin class- AbstractProcessor
 
 - 
flushprotected final void flush() throws java.io.IOException- Specified by:
- flushin class- AbstractProcessor
- Throws:
- java.io.IOException
 
 - 
availableprotected final int available(boolean doRead) - Specified by:
- availablein class- AbstractProcessor
 
 - 
setRequestBodyprotected final void setRequestBody(ByteChunk body) - Specified by:
- setRequestBodyin class- AbstractProcessor
 
 - 
setSwallowResponseprotected final void setSwallowResponse() - Specified by:
- setSwallowResponsein class- AbstractProcessor
 
 - 
disableSwallowRequestprotected final void disableSwallowRequest() - Specified by:
- disableSwallowRequestin class- AbstractProcessor
 
 - 
sslReHandShakeprotected final void sslReHandShake() throws java.io.IOExceptionDescription copied from class:AbstractProcessorProcessors that can perform a TLS re-handshake (e.g. HTTP/1.1) should override this method and implement the re-handshake.- Overrides:
- sslReHandShakein class- AbstractProcessor
- Throws:
- java.io.IOException- If authentication is required then there will be I/O with the client and this exception will be thrown if that goes wrong
 
 - 
isRequestBodyFullyReadprotected final boolean isRequestBodyFullyRead() - Specified by:
- isRequestBodyFullyReadin class- AbstractProcessor
 
 - 
registerReadInterestprotected final void registerReadInterest() - Specified by:
- registerReadInterestin class- AbstractProcessor
 
 - 
isReadyForWriteprotected final boolean isReadyForWrite() - Specified by:
- isReadyForWritein class- AbstractProcessor
 
 - 
getUpgradeTokenpublic UpgradeToken getUpgradeToken() Description copied from class:AbstractProcessorGenerate an upgrade token. Processors that implement HTTP upgrade must override this method and provide the necessary token.- Specified by:
- getUpgradeTokenin interface- Processor
- Overrides:
- getUpgradeTokenin class- AbstractProcessor
- Returns:
- An upgrade token encapsulating the information required to process the upgrade request
 
 - 
doHttpUpgradeprotected final void doHttpUpgrade(UpgradeToken upgradeToken) Description copied from class:AbstractProcessorProcess an HTTP upgrade. Processors that support HTTP upgrade should override this method and process the provided token.- Overrides:
- doHttpUpgradein class- AbstractProcessor
- Parameters:
- upgradeToken- Contains all the information necessary for the Processor to process the upgrade
 
 - 
getLeftoverInputpublic java.nio.ByteBuffer getLeftoverInput() Description copied from class:AbstractProcessorAllows retrieving additional input during the upgrade process. Processors that implement HTTP upgrade must override this method.- Specified by:
- getLeftoverInputin interface- Processor
- Overrides:
- getLeftoverInputin class- AbstractProcessor
- Returns:
- leftover bytes
 
 - 
isUpgradepublic boolean isUpgrade() Description copied from class:AbstractProcessorProcessors that implement HTTP upgrade must override this method.- Specified by:
- isUpgradein interface- Processor
- Overrides:
- isUpgradein class- AbstractProcessor
- Returns:
- trueif the Processor is currently processing an upgrade request, otherwise- false
 
 - 
recyclepublic final 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.
 
- 
 
-