Class UpgradeProcessorBase

java.lang.Object
org.apache.coyote.AbstractProcessorLight
org.apache.coyote.http11.upgrade.UpgradeProcessorBase
All Implemented Interfaces:
AutoCloseable, WebConnection, Processor
Direct Known Subclasses:
UpgradeProcessorExternal, UpgradeProcessorInternal

public abstract class UpgradeProcessorBase extends AbstractProcessorLight implements WebConnection
  • Field Details

  • Constructor Details

    • UpgradeProcessorBase

      public UpgradeProcessorBase(UpgradeToken upgradeToken)
  • Method Details

    • isUpgrade

      public final boolean isUpgrade()
      Specified by:
      isUpgrade in interface Processor
      Returns:
      true if the Processor is currently processing an upgrade request, otherwise false
    • getUpgradeToken

      public UpgradeToken getUpgradeToken()
      Description copied from interface: Processor
      Generate an upgrade token.
      Specified by:
      getUpgradeToken in interface Processor
      Returns:
      An upgrade token encapsulating the information required to process the upgrade request
    • recycle

      public final void recycle()
      Description copied from interface: Processor
      Recycle the processor, ready for the next request which may be on the same connection or a different connection.
      Specified by:
      recycle in interface Processor
    • service

      public final AbstractEndpoint.Handler.SocketState service(SocketWrapperBase<?> socketWrapper) throws IOException
      Description copied from class: AbstractProcessorLight
      Service 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 to AbstractProcessorLight.dispatch(SocketEvent). Requests may be pipe-lined.
      Specified by:
      service in class AbstractProcessorLight
      Parameters:
      socketWrapper - 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
    • asyncPostProcess

      public final AbstractEndpoint.Handler.SocketState asyncPostProcess()
      Description copied from class: AbstractProcessorLight
      Calls the post process of the async state machine.
      Specified by:
      asyncPostProcess in class AbstractProcessorLight
      Returns:
      The state the caller should put the socket in when this method returns
    • isAsync

      public final boolean isAsync()
      Specified by:
      isAsync in interface Processor
      Returns:
      true if the Processor state is async, otherwise false
    • getRequest

      public final Request getRequest()
      Specified by:
      getRequest in interface Processor
      Returns:
      The request associated with this processor.
    • getLeftoverInput

      public ByteBuffer getLeftoverInput()
      Description copied from interface: Processor
      Allows retrieving additional input during the upgrade process.
      Specified by:
      getLeftoverInput in interface Processor
      Returns:
      leftover bytes
    • checkAsyncTimeoutGeneration

      public boolean checkAsyncTimeoutGeneration()
      Description copied from interface: Processor
      Check to see if the async generation (each cycle of async increments the generation of the AsyncStateMachine) is the same as the generation when the most recent async timeout was triggered. This is intended to be used to avoid unnecessary processing.
      Specified by:
      checkAsyncTimeoutGeneration in interface Processor
      Returns:
      true If the async generation has not changed since the async timeout was triggered
    • timeoutAsync

      public void timeoutAsync(long now)
      Description copied from interface: Processor
      Check this processor to see if the timeout has expired and process a timeout if that is that case.

      Note: The name of this method originated with the Servlet 3.0 asynchronous processing but evolved over time to represent a timeout that is triggered independently of the socket read/write timeouts.

      Specified by:
      timeoutAsync in interface Processor
      Parameters:
      now - The time (as returned by System.currentTimeMillis() to use as the current time to determine whether the timeout has expired. If negative, the timeout will always be treated as if it has expired.