org.apache.coyote.http11

## Class AbstractHttp11Processor<S>

- java.lang.Object
- - org.apache.coyote.AbstractProcessor<S>
  - - org.apache.coyote.http11.AbstractHttp11Processor<S>

- All Implemented Interfaces:
    ActionHook, Processor<S>
  Direct Known Subclasses:
    Http11AprProcessor, Http11NioProcessor, Http11Processor

      public abstract class AbstractHttp11Processor<S>
      extends AbstractProcessor<S>

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `comet` Comet used.
    `protected String[]` | `compressableMimeTypes` List of MIMES which could be gzipped
    `protected int` | `compressionLevel` Allowed compression level.
    `protected int` | `compressionMinSize` Minimum content size to make compression.
    `protected int` | `connectionUploadTimeout` Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.
    `protected boolean` | `contentDelimitation` Content delimiter for the request (if false, the connection will be closed at the end of the request).
    `protected boolean` | `disableUploadTimeout` Flag to disable setting a different time-out on uploads.
    `protected boolean` | `expectation` Is there an expectation ?
    `protected char[]` | `hostNameC` Host name (used to avoid useless B2C conversion on the host name).
    `protected boolean` | `http09` HTTP/0.9 flag.
    `protected boolean` | `http11` HTTP/1.1 flag.
    `protected HttpUpgradeHandler` | `httpUpgradeHandler` Instance of the new protocol to use after the HTTP connection has been upgraded using the Servlet 3.1 based upgrade process.
    `protected boolean` | `keepAlive` Keep-alive.
    `protected int` | `keepAliveTimeout` The number of seconds Tomcat will wait for a subsequent request before closing the connection.
    `protected boolean` | `keptAlive` Flag used to indicate that the socket should treat the next request processed like a keep-alive connection - i.e. one where there may not be any data to process.
    `protected String` | `localAddr` The local Host address.
    `protected String` | `localName` Local Host associated with the current connection.
    `protected int` | `localPort` Local port to which the socket is connected
    `protected int` | `maxKeepAliveRequests` Maximum number of Keep-Alive requests to honor.
    `protected int` | `maxSavePostSize` Max saved post size.
    `protected Pattern` | `noCompressionUserAgents` Regular expression that defines the user agents to not use gzip with
    `protected boolean` | `openSocket` Flag used to indicate that the socket should be kept open (e.g. for keep alive or send file.
    `protected boolean` | `readComplete` Flag that indicates if the request headers have been completely read.
    `protected String` | `remoteAddr` Remote Address associated with the current connection.
    `protected String` | `remoteHost` Remote Host associated with the current connection.
    `protected int` | `remotePort` Remote port to which the socket is connected
    `protected Pattern` | `restrictedUserAgents` Regular expression that defines the restricted user agents.
    `protected boolean` | `sendfileInProgress` Flag that indicates that send file processing is in progress and that the socket should not be returned to the poller (where a poller is used).
    `protected String` | `server` Allow a customized the server header for the tin-foil hat folks.
    `protected static StringManager` | `sm` The string manager for this package.
    `protected int` | `socketBuffer` Socket buffering.
    `protected UpgradeInbound` | `upgradeInbound` Deprecated. Will be removed in Tomcat 8.0.x.

    - ### Fields inherited from class org.apache.coyote.AbstractProcessor

      `adapter, asyncStateMachine, endpoint, request, response, socketWrapper`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractHttp11Processor(AbstractEndpoint<S> endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `action(ActionCode actionCode, Object param)` Send an action to the connector.
    `protected abstract void` | `actionInternal(ActionCode actionCode, Object param)`
    `void` | `addCompressableMimeType(String mimeType)` Add a mime-type which will be compressible The mime-type String will be exactly matched in the response mime-type header .
    `AbstractEndpoint.Handler.SocketState` | `asyncDispatch(SocketStatus status)` Process in-progress Servlet 3.0 Async requests.
    `protected abstract boolean` | `breakKeepAliveLoop(SocketWrapper<S> socketWrapper)` Checks to see if the keep-alive loop should be broken, performing any processing (e.g. sendfile handling) that may have an impact on whether or not the keep-alive loop should be broken.
    `protected abstract boolean` | `disableKeepAlive()` Processors (currently only HTTP BIO) may elect to disable HTTP keep-alive in some circumstances.
    `void` | `endRequest()`
    `protected int` | `findBytes(ByteChunk bc, byte[] b)` Specialized utility method: find a sequence of lower case bytes inside a ByteChunk.
    `String` | `getCompression()` Return compression level.
    `int` | `getConnectionUploadTimeout()` Get the upload timeout.
    `boolean` | `getDisableUploadTimeout()` Get the flag that controls upload time-outs.
    `HttpUpgradeHandler` | `getHttpUpgradeHandler()`
    `protected abstract AbstractInputBuffer<S>` | `getInputBuffer()` Exposes input buffer to super class to allow better code re-use.
    `int` | `getKeepAliveTimeout()` Return the number Keep-Alive timeout.
    `int` | `getMaxKeepAliveRequests()` Return the number of Keep-Alive requests that we will honor.
    `int` | `getMaxSavePostSize()` Return the maximum size of a POST which will be buffered in SSL mode.
    `protected abstract AbstractOutputBuffer<S>` | `getOutputBuffer()` Exposes output buffer to super class to allow better code re-use.
    `String` | `getServer()` Get the server header name.
    `int` | `getSocketBuffer()` Get the socket buffer flag.
    `UpgradeInbound` | `getUpgradeInbound()` Deprecated. Will be removed in Tomcat 8.0.x.
    `protected abstract boolean` | `handleIncompleteRequestLineRead()` Defines how a connector handles an incomplete request line read.
    `protected void` | `initializeFilters(int maxTrailerSize, Set<String> allowedTrailerHeaders, int maxExtensionSize, int maxSwallowSize)` Initialize standard input and output filters.
    `boolean` | `isComet()`
    `boolean` | `isUpgrade()`
    `protected void` | `parseHost(MessageBytes valueMB)` Parse host.
    `protected void` | `prepareRequest()` After reading the request headers, we have to setup the request filters.
    `protected abstract void` | `prepareRequestInternal()` Connector implementation specific request preparation.
    `protected abstract boolean` | `prepareSendfile(OutputFilter[] outputFilters)`
    `AbstractEndpoint.Handler.SocketState` | `process(SocketWrapper<S> socketWrapper)` Process pipelined HTTP requests using the specified input and output streams.
    `void` | `recycle(boolean isSocketClosing)`
    `protected abstract void` | `recycleInternal()`
    `protected abstract void` | `resetTimeouts()` Provides a mechanism for those connector implementations (currently only NIO) that need to reset timeouts from Async timeouts to standard HTTP timeouts once async processing completes.
    `protected abstract void` | `setCometTimeouts(SocketWrapper<S> socketWrapper)` Provides a mechanism for those connectors (currently only NIO) that need that need to set comet timeouts.
    `void` | `setCompressableMimeTypes(String compressableMimeTypes)` Set compressable mime-type list List contains users agents separated by ',' : ie: "text/html,text/xml,text/plain"
    `void` | `setCompressableMimeTypes(String[] compressableMimeTypes)` Set compressible mime-type list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).
    `void` | `setCompression(String compression)` Set compression level.
    `void` | `setCompressionMinSize(int compressionMinSize)` Set Minimum size to trigger compression.
    `void` | `setConnectionUploadTimeout(int timeout)` Set the upload timeout.
    `void` | `setDisableUploadTimeout(boolean isDisabled)` Set the flag to control upload time-outs.
    `void` | `setKeepAliveTimeout(int timeout)` Set the Keep-Alive timeout.
    `void` | `setMaxKeepAliveRequests(int mkar)` Set the maximum number of Keep-Alive requests to honor.
    `void` | `setMaxSavePostSize(int msps)` Set the maximum size of a POST which will be buffered in SSL mode.
    `void` | `setNoCompressionUserAgents(String noCompressionUserAgents)` Set no compression user agent pattern.
    `protected abstract void` | `setRequestLineReadTimeout()` Configures the timeout to be used for reading the request line.
    `void` | `setRestrictedUserAgents(String restrictedUserAgents)` Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode).
    `void` | `setServer(String server)` Set the server header name.
    `void` | `setSocketBuffer(int socketBuffer)` Set the socket buffer flag.
    `protected abstract void` | `setSocketTimeout(int timeout)` Set the socket timeout.
    `protected boolean` | `statusDropsConnection(int status)` Determine if we must drop the connection because of the HTTP status code.
    `AbstractEndpoint.Handler.SocketState` | `upgradeDispatch()` Processes data received on a connection that has been through an HTTP upgrade.
    `AbstractEndpoint.Handler.SocketState` | `upgradeDispatch(SocketStatus status)`

    - ### Methods inherited from class org.apache.coyote.AbstractProcessor

      `asyncPostProcess, errorDispatch, event, getAdapter, getEndpoint, getErrorState, getExecutor, getLog, getRequest, getSocketWrapper, isAsync, resetErrorState, setAdapter, setErrorState, setSocketWrapper`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.coyote.Processor

      `setSslSupport`

- - ### Field Detail

    - #### sm

          protected static final StringManager sm

      The string manager for this package.

    - #### keepAlive

          protected boolean keepAlive

      Keep-alive.

    - #### openSocket

          protected boolean openSocket

      Flag used to indicate that the socket should be kept open (e.g. for keep alive or send file.

    - #### keptAlive

          protected boolean keptAlive

      Flag used to indicate that the socket should treat the next request processed like a keep-alive connection - i.e. one where there may not be any data to process. The initial value of this flag on entering the process method is different for connectors that use polling (NIO / APR - data is always expected) compared to those that use blocking (BIO - data is only expected if the connection isn't in the keep-alive state).

    - #### sendfileInProgress

          protected boolean sendfileInProgress

      Flag that indicates that send file processing is in progress and that the socket should not be returned to the poller (where a poller is used).

    - #### readComplete

          protected boolean readComplete

      Flag that indicates if the request headers have been completely read.

    - #### http11

          protected boolean http11

      HTTP/1.1 flag.

    - #### http09

          protected boolean http09

      HTTP/0.9 flag.

    - #### contentDelimitation

          protected boolean contentDelimitation

      Content delimiter for the request (if false, the connection will be closed at the end of the request).

    - #### expectation

          protected boolean expectation

      Is there an expectation ?

    - #### comet

          protected boolean comet

      Comet used.

    - #### restrictedUserAgents

          protected Pattern restrictedUserAgents

      Regular expression that defines the restricted user agents.

    - #### maxKeepAliveRequests

          protected int maxKeepAliveRequests

      Maximum number of Keep-Alive requests to honor.

    - #### keepAliveTimeout

          protected int keepAliveTimeout

      The number of seconds Tomcat will wait for a subsequent request before closing the connection.

    - #### remoteAddr

          protected String remoteAddr

      Remote Address associated with the current connection.

    - #### remoteHost

          protected String remoteHost

      Remote Host associated with the current connection.

    - #### localName

          protected String localName

      Local Host associated with the current connection.

    - #### localPort

          protected int localPort

      Local port to which the socket is connected

    - #### remotePort

          protected int remotePort

      Remote port to which the socket is connected

    - #### localAddr

          protected String localAddr

      The local Host address.

    - #### connectionUploadTimeout

          protected int connectionUploadTimeout

      Maximum timeout on uploads. 5 minutes as in Apache HTTPD server.

    - #### disableUploadTimeout

          protected boolean disableUploadTimeout

      Flag to disable setting a different time-out on uploads.

    - #### compressionLevel

          protected int compressionLevel

      Allowed compression level.

    - #### compressionMinSize

          protected int compressionMinSize

      Minimum content size to make compression.

    - #### socketBuffer

          protected int socketBuffer

      Socket buffering.

    - #### maxSavePostSize

          protected int maxSavePostSize

      Max saved post size.

    - #### noCompressionUserAgents

          protected Pattern noCompressionUserAgents

      Regular expression that defines the user agents to not use gzip with

    - #### compressableMimeTypes

          protected String[] compressableMimeTypes

      List of MIMES which could be gzipped

    - #### hostNameC

          protected char[] hostNameC

      Host name (used to avoid useless B2C conversion on the host name).

    - #### server

          protected String server

      Allow a customized the server header for the tin-foil hat folks.

    - #### upgradeInbound

          @Deprecated
          protected UpgradeInbound upgradeInbound

      Deprecated. Will be removed in Tomcat 8.0.x.
      Listener to which data available events are passed once the associated connection has completed the proprietary Tomcat HTTP upgrade process.

    - #### httpUpgradeHandler

          protected HttpUpgradeHandler httpUpgradeHandler

      Instance of the new protocol to use after the HTTP connection has been upgraded using the Servlet 3.1 based upgrade process.

  - ### Constructor Detail

    - #### AbstractHttp11Processor

          public AbstractHttp11Processor(AbstractEndpoint<S> endpoint)

  - ### Method Detail

    - #### setCompression

          public void setCompression(String compression)

      Set compression level.

    - #### setCompressionMinSize

          public void setCompressionMinSize(int compressionMinSize)

      Set Minimum size to trigger compression.

    - #### setNoCompressionUserAgents

          public void setNoCompressionUserAgents(String noCompressionUserAgents)

      Set no compression user agent pattern. Regular expression as supported by `Pattern`. ie: "gorilla|desesplorer|tigrus"

    - #### addCompressableMimeType

          public void addCompressableMimeType(String mimeType)

      Add a mime-type which will be compressible The mime-type String will be exactly matched in the response mime-type header .
      Parameters:
        `mimeType` - mime-type string

    - #### setCompressableMimeTypes

          public void setCompressableMimeTypes(String[] compressableMimeTypes)

      Set compressible mime-type list (this method is best when used with a large number of connectors, where it would be better to have all of them referenced a single array).

    - #### setCompressableMimeTypes

          public void setCompressableMimeTypes(String compressableMimeTypes)

      Set compressable mime-type list List contains users agents separated by ',' : ie: "text/html,text/xml,text/plain"

    - #### getCompression

          public String getCompression()

      Return compression level.

    - #### setRestrictedUserAgents

          public void setRestrictedUserAgents(String restrictedUserAgents)

      Set restricted user agent list (which will downgrade the connector to HTTP/1.0 mode). Regular expression as supported by `Pattern`. ie: "gorilla|desesplorer|tigrus"

    - #### setMaxKeepAliveRequests

          public void setMaxKeepAliveRequests(int mkar)

      Set the maximum number of Keep-Alive requests to honor. This is to safeguard from DoS attacks. Setting to a negative value disables the check.

    - #### getMaxKeepAliveRequests

          public int getMaxKeepAliveRequests()

      Return the number of Keep-Alive requests that we will honor.

    - #### setKeepAliveTimeout

          public void setKeepAliveTimeout(int timeout)

      Set the Keep-Alive timeout.

    - #### getKeepAliveTimeout

          public int getKeepAliveTimeout()

      Return the number Keep-Alive timeout.

    - #### setMaxSavePostSize

          public void setMaxSavePostSize(int msps)

      Set the maximum size of a POST which will be buffered in SSL mode.

    - #### getMaxSavePostSize

          public int getMaxSavePostSize()

      Return the maximum size of a POST which will be buffered in SSL mode.

    - #### setDisableUploadTimeout

          public void setDisableUploadTimeout(boolean isDisabled)

      Set the flag to control upload time-outs.

    - #### getDisableUploadTimeout

          public boolean getDisableUploadTimeout()

      Get the flag that controls upload time-outs.

    - #### setSocketBuffer

          public void setSocketBuffer(int socketBuffer)

      Set the socket buffer flag.

    - #### getSocketBuffer

          public int getSocketBuffer()

      Get the socket buffer flag.

    - #### setConnectionUploadTimeout

          public void setConnectionUploadTimeout(int timeout)

      Set the upload timeout.

    - #### getConnectionUploadTimeout

          public int getConnectionUploadTimeout()

      Get the upload timeout.

    - #### setServer

          public void setServer(String server)

      Set the server header name.

    - #### getServer

          public String getServer()

      Get the server header name.

    - #### findBytes

          protected int findBytes(ByteChunk bc,
                      byte[] b)

      Specialized utility method: find a sequence of lower case bytes inside a ByteChunk.

    - #### statusDropsConnection

          protected boolean statusDropsConnection(int status)

      Determine if we must drop the connection because of the HTTP status code. Use the same list of codes as Apache/httpd.

    - #### getInputBuffer

          protected abstract AbstractInputBuffer<S> getInputBuffer()

      Exposes input buffer to super class to allow better code re-use.
      Returns:
        The input buffer used by the processor.

    - #### getOutputBuffer

          protected abstract AbstractOutputBuffer<S> getOutputBuffer()

      Exposes output buffer to super class to allow better code re-use.
      Returns:
        The output buffer used by the processor.

    - #### initializeFilters

          protected void initializeFilters(int maxTrailerSize,
                               Set<String> allowedTrailerHeaders,
                               int maxExtensionSize,
                               int maxSwallowSize)

      Initialize standard input and output filters.

    - #### action

          public final void action(ActionCode actionCode,
                    Object param)

      Send an action to the connector.
      Parameters:
        `actionCode` - Type of the action
        `param` - Action parameter

    - #### actionInternal

          protected abstract void actionInternal(ActionCode actionCode,
                            Object param)

    - #### disableKeepAlive

          protected abstract boolean disableKeepAlive()

      Processors (currently only HTTP BIO) may elect to disable HTTP keep-alive in some circumstances. This method allows the processor implementation to determine if keep-alive should be disabled or not.

    - #### setRequestLineReadTimeout

          protected abstract void setRequestLineReadTimeout()
                                                     throws IOException

      Configures the timeout to be used for reading the request line.
      Throws:
        `IOException`

    - #### handleIncompleteRequestLineRead

          protected abstract boolean handleIncompleteRequestLineRead()

      Defines how a connector handles an incomplete request line read.
      Returns:
        `true` if the processor should break out of the processing loop, otherwise `false`.

    - #### setSocketTimeout

          protected abstract void setSocketTimeout(int timeout)
                                            throws IOException

      Set the socket timeout.
      Throws:
        `IOException`

    - #### process

          public AbstractEndpoint.Handler.SocketState process(SocketWrapper<S> socketWrapper)
                                                       throws IOException

      Process pipelined HTTP requests using the specified input and output streams.
      Specified by:
        `process` in interface `Processor<S>`
      Specified by:
        `process` in class `AbstractProcessor<S>`
      Parameters:
        `socketWrapper` - Socket from which the HTTP requests will be read and the HTTP responses will be written.
      Throws:
        `IOException` - error during an I/O operation

    - #### prepareRequest

          protected void prepareRequest()

      After reading the request headers, we have to setup the request filters.

    - #### prepareRequestInternal

          protected abstract void prepareRequestInternal()

      Connector implementation specific request preparation. Ideally, this will go away in the future.

    - #### prepareSendfile

          protected abstract boolean prepareSendfile(OutputFilter[] outputFilters)

    - #### parseHost

          protected void parseHost(MessageBytes valueMB)

      Parse host.

    - #### asyncDispatch

          public AbstractEndpoint.Handler.SocketState asyncDispatch(SocketStatus status)

      Description copied from class: `AbstractProcessor`
      Process in-progress Servlet 3.0 Async requests. These will start as HTTP requests.
      Specified by:
        `asyncDispatch` in interface `Processor<S>`
      Specified by:
        `asyncDispatch` in class `AbstractProcessor<S>`

    - #### isComet

          public boolean isComet()

      Specified by:
        `isComet` in interface `Processor<S>`
      Specified by:
        `isComet` in class `AbstractProcessor<S>`

    - #### upgradeDispatch

          public AbstractEndpoint.Handler.SocketState upgradeDispatch()
                                                               throws IOException

      Description copied from class: `AbstractProcessor`
      Processes data received on a connection that has been through an HTTP upgrade.
      Specified by:
        `upgradeDispatch` in interface `Processor<S>`
      Specified by:
        `upgradeDispatch` in class `AbstractProcessor<S>`
      Throws:
        `IOException`

    - #### getUpgradeInbound

          @Deprecated
          public UpgradeInbound getUpgradeInbound()

      Deprecated. Will be removed in Tomcat 8.0.x.
      Specified by:
        `getUpgradeInbound` in interface `Processor<S>`
      Specified by:
        `getUpgradeInbound` in class `AbstractProcessor<S>`

    - #### isUpgrade

          public boolean isUpgrade()

      Specified by:
        `isUpgrade` in interface `Processor<S>`
      Specified by:
        `isUpgrade` in class `AbstractProcessor<S>`

    - #### upgradeDispatch

          public AbstractEndpoint.Handler.SocketState upgradeDispatch(SocketStatus status)
                                                               throws IOException

      Throws:
        `IOException`

    - #### getHttpUpgradeHandler

          public HttpUpgradeHandler getHttpUpgradeHandler()

    - #### resetTimeouts

          protected abstract void resetTimeouts()

      Provides a mechanism for those connector implementations (currently only NIO) that need to reset timeouts from Async timeouts to standard HTTP timeouts once async processing completes.

    - #### setCometTimeouts

          protected abstract void setCometTimeouts(SocketWrapper<S> socketWrapper)

      Provides a mechanism for those connectors (currently only NIO) that need that need to set comet timeouts.

    - #### endRequest

          public void endRequest()

    - #### breakKeepAliveLoop

          protected abstract boolean breakKeepAliveLoop(SocketWrapper<S> socketWrapper)

      Checks to see if the keep-alive loop should be broken, performing any processing (e.g. sendfile handling) that may have an impact on whether or not the keep-alive loop should be broken.
      Returns:
        true if the keep-alive loop should be broken

    - #### recycle

          public final void recycle(boolean isSocketClosing)

    - #### recycleInternal

          protected abstract void recycleInternal()

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.