Class HttpRequestMessageDecoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.MessageToMessageDecoder<io.netty.handler.codec.http.FullHttpRequest>
-
- org.apache.tinkerpop.gremlin.server.handler.HttpRequestMessageDecoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
@Sharable public class HttpRequestMessageDecoder extends io.netty.handler.codec.MessageToMessageDecoder<io.netty.handler.codec.http.FullHttpRequest>
Decodes the contents of aFullHttpRequest
. This will extract theRequestMessage
from theFullHttpRequest
or, if unsuccessful, will flush an error back.
-
-
Constructor Summary
Constructors Constructor Description HttpRequestMessageDecoder(Map<String,MessageSerializer<?>> serializers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req, List<Object> objects)
RequestMessage
getRequestMessageFromHttpRequest(io.netty.handler.codec.http.FullHttpRequest request, Map<String,MessageSerializer<?>> serializers)
Convert a http request into aRequestMessage
.-
Methods inherited from class io.netty.handler.codec.MessageToMessageDecoder
acceptInboundMessage, channelRead
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Constructor Detail
-
HttpRequestMessageDecoder
public HttpRequestMessageDecoder(Map<String,MessageSerializer<?>> serializers)
-
-
Method Detail
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req, List<Object> objects) throws Exception
- Specified by:
decode
in classio.netty.handler.codec.MessageToMessageDecoder<io.netty.handler.codec.http.FullHttpRequest>
- Throws:
Exception
-
getRequestMessageFromHttpRequest
public RequestMessage getRequestMessageFromHttpRequest(io.netty.handler.codec.http.FullHttpRequest request, Map<String,MessageSerializer<?>> serializers) throws SerializationException
Convert a http request into aRequestMessage
. There are 2 payload types options here. 1. existing https://tinkerpop.apache.org/docs/current/reference/#connecting-via-http intended to use with curl, postman, etc. by users both GET and POST Content-Type header can be empty or application/json Accept header can be any, most useful can be application/json, text/plain, application/vnd.gremlin-v3.0+json and application/vnd.gremlin-v3.0+json;types=false Request body example: { "gremlin": "g.V()" } 2. experimental payload with serialized RequestMessage intended for drivers/GLV's. Support only gremlin. only POST Content-Type is defined by used serializer, expected type GraphSON application/vnd.gremlin-v3.0+json or GraphBinary application/vnd.graphbinary-v1.0. Untyped GraphSON is not supported, it can't deserialize parameters Accept header can be any. Request body contains serialized RequestMessage- Throws:
SerializationException
-
-