Class HTTP11Processor

java.lang.Object
io.fusionauth.http.server.HTTP11Processor
All Implemented Interfaces:
HTTPProcessor

public class HTTP11Processor extends Object implements HTTPProcessor
A worker that handles a single request/response from a client.
Author:
Brian Pontarelli
  • Constructor Details

  • Method Details

    • close

      public ProcessorState close(boolean endOfStream)
      Description copied from interface: HTTPProcessor
      Closes the processing. In some cases, the process of closing a connection might require additional work, like shutting down TLS. Therefore, this method can interrupt a normal shutdown.
      Specified by:
      close in interface HTTPProcessor
      Parameters:
      endOfStream - True if the stream is being closed due to an unexpected end-of-stream.
      Returns:
      The new state of the processor.
    • failure

      public void failure(Throwable t)
      Description copied from interface: HTTPProcessor
      Signals to the processor that the request handling failed in some way.
      Specified by:
      failure in interface HTTPProcessor
      Parameters:
      t - The exception that caused the failure, it there was one.
    • initialKeyOps

      public int initialKeyOps()
      Non-TLS so always start by reading from the client.
      Specified by:
      initialKeyOps in interface HTTPProcessor
      Returns:
      SelectionKey.OP_READ
      See Also:
    • lastUsed

      public long lastUsed()
      Specified by:
      lastUsed in interface HTTPProcessor
      Returns:
      The instant that this processor was last used.
    • markUsed

      public void markUsed()
    • read

      public ProcessorState read(ByteBuffer buffer) throws IOException
      Description copied from interface: HTTPProcessor
      Allows the HTTPProcessor to handle bytes that were read.
      Specified by:
      read in interface HTTPProcessor
      Parameters:
      buffer - The bytes read from the client.
      Returns:
      The new state of the HTTPProcessor.
      Throws:
      IOException - If any I/O operations failed.
    • readBuffer

      public ByteBuffer readBuffer()
      Specified by:
      readBuffer in interface HTTPProcessor
      Returns:
      The current read buffer or null if the state has changed or there we aren't expecting to read.
    • readThroughput

      public long readThroughput()
      Specified by:
      readThroughput in interface HTTPProcessor
      Returns:
      The bytes per second throughput read by this processor.
    • state

      public ProcessorState state()
      Specified by:
      state in interface HTTPProcessor
      Returns:
      The current state of the HTTPProcessor.
    • writeBuffers

      public ByteBuffer[] writeBuffers()
      Specified by:
      writeBuffers in interface HTTPProcessor
      Returns:
      The current write buffer(s) and never null.
    • writeThroughput

      public long writeThroughput()
      Specified by:
      writeThroughput in interface HTTPProcessor
      Returns:
      The bytes per second throughput wrote by this processor.
    • wrote

      public ProcessorState wrote(long num)
      Description copied from interface: HTTPProcessor
      Called by the selector to tell the HTTPProcessor that bytes were written back to the client.
      Specified by:
      wrote in interface HTTPProcessor
      Parameters:
      num - The number of bytes written.
      Returns:
      The new state of the HTTPProcessor.