Class HttpsRelayServiceHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
- Direct Known Subclasses:
EppServiceHandler
,WhoisServiceHandler
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 are contained in the HTTP response headers, which are added back to headers of subsequent HTTP requests.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Exception thrown when the response status from GAE is not 200.Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
decode
(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf byteBuf, List<Object> out) protected io.netty.handler.codec.http.FullHttpRequest
decodeFullHttpRequest
(io.netty.buffer.ByteBuf byteBuf) Construct theFullHttpRequest
.protected void
encode
(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpResponse response, io.netty.buffer.ByteBuf byteBuf) void
exceptionCaught
(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) Terminates connection upon inbound exception.void
write
(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise 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 io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Field Details
-
NON_FATAL_INBOUND_EXCEPTIONS
-
NON_FATAL_OUTBOUND_EXCEPTIONS
-
metrics
-
-
Method Details
-
decodeFullHttpRequest
protected io.netty.handler.codec.http.FullHttpRequest decodeFullHttpRequest(io.netty.buffer.ByteBuf byteBuf) Construct theFullHttpRequest
.This default method creates a bare-bone
FullHttpRequest
that may need to be modified, e.g. adding headers specific for each protocol.- Parameters:
byteBuf
- inbound message.
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf byteBuf, List<Object> out) - Specified by:
decode
in classio.netty.handler.codec.ByteToMessageCodec<io.netty.handler.codec.http.FullHttpResponse>
-
encode
protected void encode(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpResponse response, io.netty.buffer.ByteBuf byteBuf) throws Exception - Specified by:
encode
in classio.netty.handler.codec.ByteToMessageCodec<io.netty.handler.codec.http.FullHttpResponse>
- Throws:
Exception
-
exceptionCaught
Terminates connection upon inbound exception.- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) throws Exception Terminates connection upon outbound exception.- Specified by:
write
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classio.netty.handler.codec.ByteToMessageCodec<io.netty.handler.codec.http.FullHttpResponse>
- Throws:
Exception
-