Class HttpsRelayServiceHandler

  • All Implemented Interfaces:,,
    Direct Known Subclasses:
    EppServiceHandler, WhoisServiceHandler

    public abstract class HttpsRelayServiceHandler
    extends io.netty.handler.codec.ByteToMessageCodec<io.netty.handler.codec.http.FullHttpResponse>
    Handler that relays a single (framed) ByteBuf message to an HTTPS server.

    This handler reads in a ByteBuf, converts it to an FullHttpRequest, and passes it to the channelRead method of the next inbound handler the channel pipeline, which is usually a RelayHandler<FullHttpRequest>. The relay handler writes the request to the relay channel, which is connected to an HTTPS endpoint. After the relay channel receives a FullHttpResponse back, its own relay handler writes the response back to this channel, which is the relay channel of the relay channel. This handler then handles write request by encoding the FullHttpResponse to a plain ByteBuf, and pass it down to the write method of the next outbound handler in the channel pipeline, which eventually writes the response bytes to the remote peer of this channel.

    This handler is session aware and will store all the session cookies that the are contained in the HTTP response headers, which are added back to headers of subsequent HTTP requests.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  HttpsRelayServiceHandler.NonOkHttpResponseException
      Exception thrown when the response status from GAE is not 200.
      • Nested classes/interfaces inherited from interface
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void decode​( ctx, io.netty.buffer.ByteBuf byteBuf, java.util.List<java.lang.Object> out)  
      protected io.netty.handler.codec.http.FullHttpRequest decodeFullHttpRequest​(io.netty.buffer.ByteBuf byteBuf)
      Construct the FullHttpRequest.
      protected void encode​( ctx, io.netty.handler.codec.http.FullHttpResponse response, io.netty.buffer.ByteBuf byteBuf)  
      void exceptionCaught​( ctx, java.lang.Throwable cause)
      Terminates connection upon inbound exception.
      void write​( ctx, java.lang.Object msg, promise)
      Terminates connection upon outbound exception.
      • Methods inherited from class io.netty.handler.codec.ByteToMessageCodec

        acceptOutboundMessage, channelInactive, channelRead, channelReadComplete, decodeLast, handlerAdded, handlerRemoved
      • Methods inherited from class

        bind, close, connect, deregister, disconnect, flush, read
      • Methods inherited from class

        channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
      • Methods inherited from class

        ensureNotSharable, isSharable
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail


        protected static final<java.lang.Class<? extends java.lang.Exception>> NON_FATAL_INBOUND_EXCEPTIONS

        protected static final<java.lang.Class<? extends java.lang.Exception>> NON_FATAL_OUTBOUND_EXCEPTIONS
    • Method Detail

      • decodeFullHttpRequest

        protected io.netty.handler.codec.http.FullHttpRequest decodeFullHttpRequest​(io.netty.buffer.ByteBuf byteBuf)
        Construct the FullHttpRequest.

        This default method creates a bare-bone FullHttpRequest that may need to be modified, e. g. adding headers specific for each protocol.

        byteBuf - inbound message.
      • decode

        protected void decode​( ctx,
                              io.netty.buffer.ByteBuf byteBuf,
                              java.util.List<java.lang.Object> out)
        Specified by:
        decode in class io.netty.handler.codec.ByteToMessageCodec<io.netty.handler.codec.http.FullHttpResponse>
      • encode

        protected void encode​( ctx,
                              io.netty.handler.codec.http.FullHttpResponse response,
                              io.netty.buffer.ByteBuf byteBuf)
                       throws java.lang.Exception
        Specified by:
        encode in class io.netty.handler.codec.ByteToMessageCodec<io.netty.handler.codec.http.FullHttpResponse>
      • exceptionCaught

        public void exceptionCaught​( ctx,
                                    java.lang.Throwable cause)
        Terminates connection upon inbound exception.
        Specified by:
        exceptionCaught in interface
        Specified by:
        exceptionCaught in interface
        exceptionCaught in class
      • write

        public void write​( ctx,
                          java.lang.Object msg,
                   throws java.lang.Exception
        Terminates connection upon outbound exception.
        Specified by:
        write in interface
        write in class io.netty.handler.codec.ByteToMessageCodec<io.netty.handler.codec.http.FullHttpResponse>