Class BufferedResponseHandler

All Implemented Interfaces:
Handler, Handler.Container, Handler.Singleton, Request.Handler, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, Invocable

public class BufferedResponseHandler extends ConditionalHandler.Abstract

A Handler that can apply a mechanism to buffer the entire response content until the output is closed. This allows the commit to be delayed until the response is complete and thus headers and response status can be changed while writing the body.

Note that the decision to buffer is influenced by the headers and status at the first write, and thus subsequent changes to those headers will not influence the decision to buffer or not.

Note also that the size of the buffer can be controlled by setting the BUFFER_SIZE_ATTRIBUTE_NAME request attribute to an integer; in the absence of such header, the HttpConfiguration.getOutputBufferSize() config setting is used, while the maximum aggregation size can be controlled by setting the MAX_AGGREGATION_SIZE_ATTRIBUTE_NAME request attribute to an integer, in the absence of such header, the HttpConfiguration.getOutputAggregationSize() config setting is used.

  • Field Details

    • BUFFER_SIZE_ATTRIBUTE_NAME

      public static final String BUFFER_SIZE_ATTRIBUTE_NAME
      The name of the request attribute used to control the buffer size of a particular request.
    • MAX_AGGREGATION_SIZE_ATTRIBUTE_NAME

      public static final String MAX_AGGREGATION_SIZE_ATTRIBUTE_NAME
      The name of the request attribute used to control the max aggregation size of a particular request.
  • Constructor Details

    • BufferedResponseHandler

      public BufferedResponseHandler()
    • BufferedResponseHandler

      public BufferedResponseHandler(Handler handler)
  • Method Details