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 a FullHttpRequest. This will extract the RequestMessage from the FullHttpRequest or, if unsuccessful, will flush an error back.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req, List<Object> objects)
     
    getRequestMessageFromHttpRequest(io.netty.handler.codec.http.FullHttpRequest request, Map<String,MessageSerializer<?>> serializers)
    Convert a http request into a RequestMessage.

    Methods inherited from class io.netty.handler.codec.MessageToMessageDecoder

    acceptInboundMessage, channelRead, channelReadComplete

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Constructor Details

  • Method Details

    • 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 class io.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 a RequestMessage. 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