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 anHttpPayloadWriterof typeHttpSerializerwhich serializes eachwritten objectinto aBuffer.Bufferserialize(HttpHeaders headers, T value, BufferAllocator allocator)Serialize an object of typeHttpSerializerinto aBuffer.
-
-
-
Method Detail
-
serialize
Buffer serialize(HttpHeaders headers, T value, BufferAllocator allocator)
Serialize an object of typeHttpSerializerinto aBuffer. If necessary theHttpHeadersshould be updated to indicate the content-type.- Parameters:
headers- TheHttpHeadersassociated with the serialization operation.value- The object to serialize.allocator- TheBufferAllocatorused to create the returnedBuffer.- Returns:
- The result of the serialization operation.
-
serialize
BlockingIterable<Buffer> serialize(HttpHeaders headers, BlockingIterable<T> value, BufferAllocator allocator)
Serialize anBlockingIterableof typeHttpSerializerinto anBlockingIterableof typeBuffer. If necessary theHttpHeadersshould be updated to indicate the content-type.- Parameters:
headers- TheHttpHeadersassociated with the serialization operation.value- The objects to serialize.allocator- TheBufferAllocatorused to create the resultingBuffers.- Returns:
- The result of the serialization operation.
-
serialize
Publisher<Buffer> serialize(HttpHeaders headers, Publisher<T> value, BufferAllocator allocator)
Serialize aPublisherof typeHttpSerializerinto aPublisherof typeBuffer. If necessary theHttpHeadersshould be updated to indicate the content-type.- Parameters:
headers- TheHttpHeadersassociated with the serialization operation.value- The objects to serialize.allocator- TheBufferAllocatorused to create the resultingBuffers.- Returns:
- The result of the serialization operation.
-
serialize
HttpPayloadWriter<T> serialize(HttpHeaders headers, HttpPayloadWriter<Buffer> payloadWriter, BufferAllocator allocator)
Returns anHttpPayloadWriterof typeHttpSerializerwhich serializes eachwritten objectinto aBuffer. If necessary theHttpHeadersshould be updated to indicate the content-type.- Parameters:
headers- TheHttpHeadersassociated with the serialization operation.payloadWriter- TheHttpPayloadWriterwhich writes serializedBuffers.allocator- TheBufferAllocatorused to create the resultingBuffers.- Returns:
- The
HttpPayloadWriterof typeHttpSerializerwith embedded serialization into aBuffer.
-
-