Package org.simpleframework.http.core
Class BodyEncoderFactory
- java.lang.Object
-
- org.simpleframework.http.core.BodyEncoderFactory
-
class BodyEncoderFactory extends java.lang.Object
TheBodyEncoderFactory
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:
ResponseEncoder
-
-
Field Summary
Fields Modifier and Type Field Description private BodyObserver
observer
This is the monitor used to notify the initiator of events.private Conversation
support
This is used to determine the semantics of the HTTP pipeline.private ByteWriter
writer
This is the underlying sender used to deliver the raw data.
-
Constructor Summary
Constructors Constructor Description BodyEncoderFactory(BodyObserver observer, Conversation support, Channel channel)
Constructor for theBodyEncoderFactory
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BodyEncoder
getInstance()
This is used to create an aBodyEncoder
object that can be used to encode content according to the HTTP header.private BodyEncoder
getInstance(boolean chunkable)
This is used to create an aBodyEncoder
object that can be used to encode content according to the HTTP header.
-
-
-
Field Detail
-
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 Detail
-
BodyEncoderFactory
public BodyEncoderFactory(BodyObserver observer, Conversation support, Channel channel)
Constructor for theBodyEncoderFactory
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 kernelsupport
- this contains details regarding the semanticswriter
- this is used to send to the underlying transport
-
-
Method Detail
-
getInstance
public BodyEncoder getInstance()
This is used to create an aBodyEncoder
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 aBodyEncoder
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
-
-