Class BodyEncoderFactory

java.lang.Object
org.simpleframework.http.core.BodyEncoderFactory

class BodyEncoderFactory extends Object
The BodyEncoderFactory is used to create a producer to match the HTTP header sent with the response. This interprets the headers within the response and composes a producer that will match those. Producers can be created to send in chunked encoding format, as well as fixed length and connection close for HTTP/1.0.
See Also:
  • Field Details

    • support

      private final Conversation support
      This is used to determine the semantics of the HTTP pipeline.
    • observer

      private final BodyObserver observer
      This is the monitor used to notify the initiator of events.
    • writer

      private final ByteWriter writer
      This is the underlying sender used to deliver the raw data.
  • Constructor Details

    • BodyEncoderFactory

      public BodyEncoderFactory(BodyObserver observer, Conversation support, Channel channel)
      Constructor for the BodyEncoderFactory object. This is used to create producers that can encode data in a HTTP compliant format. Each producer created will produce its data and deliver it to the specified sender, should an I/O events occur such as an error, or completion of the response then the monitor is notified and the server kernel takes action.
      Parameters:
      observer - this is used to deliver signals to the kernel
      support - this contains details regarding the semantics
      writer - this is used to send to the underlying transport
  • Method Details

    • getInstance

      public BodyEncoder getInstance()
      This is used to create an a BodyEncoder object that can be used to encode content according to the HTTP header. If the request was from a HTTP/1.0 client that did not ask for keep alive connection semantics a simple close producer is created. Otherwise the content is chunked encoded or sent according the the Content-Length.
      Returns:
      this returns the producer used to send the response
    • getInstance

      private BodyEncoder getInstance(boolean chunkable)
      This is used to create an a BodyEncoder object that can be used to encode content according to the HTTP header. If the request was from a HTTP/1.0 client that did not ask for keep alive connection semantics a simple close producer is created. Otherwise the content is chunked encoded or sent according the the Content-Length.
      Parameters:
      chunkable - does the connected client support chunked
      Returns:
      this returns the producer used to send the response