org.apache.coyote

## Class AbstractProcessor<S>

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

- All Implemented Interfaces:
    ActionHook, Processor<S>
  Direct Known Subclasses:
    AbstractAjpProcessor, AbstractHttp11Processor

      public abstract class AbstractProcessor<S>
      extends java.lang.Object
      implements ActionHook, Processor<S>

  Provides functionality and attributes common to all supported protocols (currently HTTP and AJP).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Adapter` | `adapter`
    `protected AsyncStateMachine<S>` | `asyncStateMachine`
    `protected AbstractEndpoint<S>` | `endpoint`
    `protected char[]` | `hostNameC`
    `protected Request` | `request`
    `protected Response` | `response`
    `protected static StringManager` | `sm`
    `protected SocketWrapper<S>` | `socketWrapper`
    `protected UserDataHelper` | `userDataHelper`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractProcessor()` Intended for use by the Upgrade sub-classes that have no need to initialise the request, response, etc.
    `` | `AbstractProcessor(AbstractEndpoint<S> endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract AbstractEndpoint.Handler.SocketState` | `asyncDispatch(SocketStatus status)` Process in-progress Servlet 3.0 Async requests.
    `AbstractEndpoint.Handler.SocketState` | `asyncPostProcess()`
    `void` | `errorDispatch()`
    `abstract AbstractEndpoint.Handler.SocketState` | `event(SocketStatus status)` Process in-progress Comet requests.
    `Adapter` | `getAdapter()` Get the associated adapter.
    `AsyncStateMachine<S>` | `getAsyncStateMachine()`
    `protected AbstractEndpoint<S>` | `getEndpoint()`
    `protected ErrorState` | `getErrorState()`
    `java.util.concurrent.Executor` | `getExecutor()`
    `protected abstract Log` | `getLog()`
    `int` | `getMaxCookieCount()`
    `Request` | `getRequest()` The request associated with this processor.
    `protected SocketWrapper<S>` | `getSocketWrapper()`
    `abstract UpgradeInbound` | `getUpgradeInbound()` Deprecated. Will be removed in Tomcat 8.0.x.
    `boolean` | `isAsync()`
    `abstract boolean` | `isComet()`
    `abstract boolean` | `isUpgrade()`
    `protected void` | `parseHost(MessageBytes valueMB)`
    `protected void` | `populateHost()` Called when a host header is not present in the request (e.g.
    `protected void` | `populatePort()` Called when a host header is not present or is empty in the request (e.g.
    `abstract AbstractEndpoint.Handler.SocketState` | `process(SocketWrapper<S> socket)` Process HTTP requests.
    `protected void` | `resetErrorState()`
    `void` | `setAdapter(Adapter adapter)` Set the associated adapter.
    `protected void` | `setErrorState(ErrorState errorState, java.lang.Throwable t)` Update the current error state to the new error state if the new error state is more severe than the current error state.
    `void` | `setMaxCookieCount(int maxCookieCount)`
    `protected void` | `setSocketWrapper(SocketWrapper<S> socketWrapper)` Set the socket wrapper being used.
    `abstract AbstractEndpoint.Handler.SocketState` | `upgradeDispatch()` Processes data received on a connection that has been through an HTTP upgrade.

    - ### 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.ActionHook

      `action`

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

      `getHttpUpgradeHandler, recycle, setSslSupport, upgradeDispatch`

- - ### Field Detail

    - #### sm

          protected static final StringManager sm

    - #### hostNameC

          protected char[] hostNameC

    - #### adapter

          protected Adapter adapter

    - #### asyncStateMachine

          protected AsyncStateMachine<S> asyncStateMachine

    - #### endpoint

          protected AbstractEndpoint<S> endpoint

    - #### request

          protected Request request

    - #### response

          protected Response response

    - #### socketWrapper

          protected SocketWrapper<S> socketWrapper

    - #### userDataHelper

          protected final UserDataHelper userDataHelper

  - ### Constructor Detail

    - #### AbstractProcessor

          protected AbstractProcessor()

      Intended for use by the Upgrade sub-classes that have no need to initialise the request, response, etc.

    - #### AbstractProcessor

          public AbstractProcessor(AbstractEndpoint<S> endpoint)

  - ### Method Detail

    - #### setErrorState

          protected void setErrorState(ErrorState errorState,
                           java.lang.Throwable t)

      Update the current error state to the new error state if the new error state is more severe than the current error state.
      Parameters:
        `errorState` - The error status details
        `t` - The error which occurred

    - #### resetErrorState

          protected void resetErrorState()

    - #### getErrorState

          protected ErrorState getErrorState()

    - #### getEndpoint

          protected AbstractEndpoint<S> getEndpoint()

      Returns:
        The endpoint receiving connections that are handled by this processor.

    - #### getRequest

          public Request getRequest()

      The request associated with this processor.
      Specified by:
        `getRequest` in interface `Processor<S>`

    - #### setAdapter

          public void setAdapter(Adapter adapter)

      Set the associated adapter.
      Parameters:
        `adapter` - the new adapter

    - #### getAdapter

          public Adapter getAdapter()

      Get the associated adapter.
      Returns:
        the associated adapter

    - #### setSocketWrapper

          protected final void setSocketWrapper(SocketWrapper<S> socketWrapper)

      Set the socket wrapper being used.
      Parameters:
        `socketWrapper` - The socket wrapper

    - #### getSocketWrapper

          protected final SocketWrapper<S> getSocketWrapper()

      Returns:
        the socket wrapper being used.

    - #### getExecutor

          public java.util.concurrent.Executor getExecutor()

      Specified by:
        `getExecutor` in interface `Processor<S>`
      Returns:
        the Executor used by the underlying endpoint.

    - #### isAsync

          public boolean isAsync()

      Specified by:
        `isAsync` in interface `Processor<S>`

    - #### asyncPostProcess

          public AbstractEndpoint.Handler.SocketState asyncPostProcess()

      Specified by:
        `asyncPostProcess` in interface `Processor<S>`

    - #### errorDispatch

          public void errorDispatch()

      Specified by:
        `errorDispatch` in interface `Processor<S>`

    - #### isComet

          public abstract boolean isComet()

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

    - #### parseHost

          protected void parseHost(MessageBytes valueMB)

    - #### 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.

    - #### 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.

    - #### isUpgrade

          public abstract boolean isUpgrade()

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

    - #### process

          public abstract AbstractEndpoint.Handler.SocketState process(SocketWrapper<S> socket)
                                                                throws java.io.IOException

      Process HTTP requests. All requests are treated as HTTP requests to start with although they may change type during processing.
      Specified by:
        `process` in interface `Processor<S>`
      Throws:
        `java.io.IOException`

    - #### event

          public abstract AbstractEndpoint.Handler.SocketState event(SocketStatus status)
                                                              throws java.io.IOException

      Process in-progress Comet requests. These will start as HTTP requests.
      Specified by:
        `event` in interface `Processor<S>`
      Throws:
        `java.io.IOException`

    - #### asyncDispatch

          public abstract AbstractEndpoint.Handler.SocketState asyncDispatch(SocketStatus status)

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

    - #### upgradeDispatch

          public abstract AbstractEndpoint.Handler.SocketState upgradeDispatch()
                                                                        throws java.io.IOException

      Processes data received on a connection that has been through an HTTP upgrade.
      Specified by:
        `upgradeDispatch` in interface `Processor<S>`
      Returns:
        The socket state once the upgrade dispatch event has been processed.
      Throws:
        `java.io.IOException` - An IO error occurred

    - #### getMaxCookieCount

          public int getMaxCookieCount()

    - #### setMaxCookieCount

          public void setMaxCookieCount(int maxCookieCount)

    - #### getUpgradeInbound

          @Deprecated
          public abstract UpgradeInbound getUpgradeInbound()

      Deprecated. Will be removed in Tomcat 8.0.x.
      Specified by:
        `getUpgradeInbound` in interface `Processor<S>`
      Returns:
        Listener to which data available events are passed once the associated connection has completed the proprietary Tomcat HTTP upgrade process.

    - #### getLog

          protected abstract Log getLog()

    - #### getAsyncStateMachine

          public final AsyncStateMachine<S> getAsyncStateMachine()

      Specified by:
        `getAsyncStateMachine` in interface `Processor<S>`

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