Package io.servicetalk.http.api
Interface HttpSerializer<T>
-
- Type Parameters:
T
- The type of objects to serialize.
public interface HttpSerializer<T>
A factory to address serialization concerns for HTTP request/response payload bodies.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Publisher<Buffer>
serialize(HttpHeaders headers, Publisher<T> value, BufferAllocator allocator)
BlockingIterable<Buffer>
serialize(HttpHeaders headers, BlockingIterable<T> value, BufferAllocator allocator)
HttpPayloadWriter<T>
serialize(HttpHeaders headers, HttpPayloadWriter<Buffer> payloadWriter, BufferAllocator allocator)
Returns anHttpPayloadWriter
of typeHttpSerializer
which serializes eachwritten object
into aBuffer
.Buffer
serialize(HttpHeaders headers, T value, BufferAllocator allocator)
Serialize an object of typeHttpSerializer
into aBuffer
.
-
-
-
Method Detail
-
serialize
Buffer serialize(HttpHeaders headers, T value, BufferAllocator allocator)
Serialize an object of typeHttpSerializer
into aBuffer
. If necessary theHttpHeaders
should be updated to indicate the content-type.- Parameters:
headers
- TheHttpHeaders
associated with the serialization operation.value
- The object to serialize.allocator
- TheBufferAllocator
used to create the returnedBuffer
.- Returns:
- The result of the serialization operation.
-
serialize
BlockingIterable<Buffer> serialize(HttpHeaders headers, BlockingIterable<T> value, BufferAllocator allocator)
Serialize anBlockingIterable
of typeHttpSerializer
into anBlockingIterable
of typeBuffer
. If necessary theHttpHeaders
should be updated to indicate the content-type.- Parameters:
headers
- TheHttpHeaders
associated with the serialization operation.value
- The objects to serialize.allocator
- TheBufferAllocator
used to create the resultingBuffer
s.- Returns:
- The result of the serialization operation.
-
serialize
Publisher<Buffer> serialize(HttpHeaders headers, Publisher<T> value, BufferAllocator allocator)
Serialize aPublisher
of typeHttpSerializer
into aPublisher
of typeBuffer
. If necessary theHttpHeaders
should be updated to indicate the content-type.- Parameters:
headers
- TheHttpHeaders
associated with the serialization operation.value
- The objects to serialize.allocator
- TheBufferAllocator
used to create the resultingBuffer
s.- Returns:
- The result of the serialization operation.
-
serialize
HttpPayloadWriter<T> serialize(HttpHeaders headers, HttpPayloadWriter<Buffer> payloadWriter, BufferAllocator allocator)
Returns anHttpPayloadWriter
of typeHttpSerializer
which serializes eachwritten object
into aBuffer
. If necessary theHttpHeaders
should be updated to indicate the content-type.- Parameters:
headers
- TheHttpHeaders
associated with the serialization operation.payloadWriter
- TheHttpPayloadWriter
which writes serializedBuffer
s.allocator
- TheBufferAllocator
used to create the resultingBuffer
s.- Returns:
- The
HttpPayloadWriter
of typeHttpSerializer
with embedded serialization into aBuffer
.
-
-