public interface MessageSerializer<M>
Iterator as returned from the ScriptEngine or an incoming RequestMessage.
MessageSerializer instances are instantiated to a cache via ServiceLoader and indexed based on
the mime types they support. If a mime type is supported more than once, the first MessageSerializer
instance loaded for that mime type is assigned. If a mime type is not found the server default is chosen. The
default may change from version to version so it is best to not rely on it when developing applications and to
always be explicit in specifying the type you wish to bind to.| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
logger |
| Modifier and Type | Method and Description |
|---|---|
default void |
configure(Map<String,Object> config,
Map<String,Graph> graphs)
Configure the serializer with mapper settings as required.
|
RequestMessage |
deserializeRequest(io.netty.buffer.ByteBuf msg)
Deserialize a Netty
ByteBuf into a RequestMessage. |
ResponseMessage |
deserializeResponse(io.netty.buffer.ByteBuf msg)
Deserialize a Netty
ByteBuf into a ResponseMessage. |
M |
getMapper()
Gets the "mapper" that performs the underlying serialization work.
|
String[] |
mimeTypesSupported()
The list of mime types that the serializer supports.
|
io.netty.buffer.ByteBuf |
serializeRequestAsBinary(RequestMessage requestMessage,
io.netty.buffer.ByteBufAllocator allocator)
Serialize a
ResponseMessage to a Netty ByteBuf. |
io.netty.buffer.ByteBuf |
serializeResponseAsBinary(ResponseMessage responseMessage,
io.netty.buffer.ByteBufAllocator allocator)
Serialize a
ResponseMessage to a Netty ByteBuf. |
M getMapper()
io.netty.buffer.ByteBuf serializeResponseAsBinary(ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator) throws SerializationException
ResponseMessage to a Netty ByteBuf.responseMessage - The response message to serialize to bytes.allocator - The Netty allocator for the ByteBuf to return back.SerializationExceptionio.netty.buffer.ByteBuf serializeRequestAsBinary(RequestMessage requestMessage, io.netty.buffer.ByteBufAllocator allocator) throws SerializationException
ResponseMessage to a Netty ByteBuf.requestMessage - The request message to serialize to bytes.allocator - The Netty allocator for the ByteBuf to return back.SerializationExceptionRequestMessage deserializeRequest(io.netty.buffer.ByteBuf msg) throws SerializationException
ByteBuf into a RequestMessage.SerializationExceptionResponseMessage deserializeResponse(io.netty.buffer.ByteBuf msg) throws SerializationException
ByteBuf into a ResponseMessage.SerializationExceptionString[] mimeTypesSupported()
default void configure(Map<String,Object> config, Map<String,Graph> graphs)
Copyright © 2013–2023 Apache Software Foundation. All rights reserved.