Package io.netty5.handler.codec.http
Class HttpClientUpgradeHandler<C extends HttpContent<C>>
- java.lang.Object
-
- io.netty5.channel.ChannelHandlerAdapter
-
- io.netty5.handler.codec.MessageToMessageDecoder<I>
-
- io.netty5.handler.codec.MessageAggregatorNew<HttpObject,HttpMessage,HttpContent<C>,FullHttpMessage<?>>
-
- io.netty5.handler.codec.http.HttpObjectAggregator<C>
-
- io.netty5.handler.codec.http.HttpClientUpgradeHandler<C>
-
- All Implemented Interfaces:
io.netty5.channel.ChannelHandler
public class HttpClientUpgradeHandler<C extends HttpContent<C>> extends HttpObjectAggregator<C>
Client-side handler for handling an HTTP upgrade handshake to another protocol. When the first HTTP request is sent, this handler will add all appropriate headers to perform an upgrade to the new protocol. If the upgrade fails (i.e. response is not 101 Switching Protocols), this handler simply removes itself from the pipeline. If the upgrade is successful, upgrades the pipeline to the new protocol.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceHttpClientUpgradeHandler.SourceCodecThe source codec that is used in the pipeline initially.static interfaceHttpClientUpgradeHandler.UpgradeCodecA codec that the source can be upgraded to.static classHttpClientUpgradeHandler.UpgradeEventUser events that are fired to notify about upgrade status.
-
Constructor Summary
Constructors Constructor Description HttpClientUpgradeHandler(HttpClientUpgradeHandler.SourceCodec sourceCodec, HttpClientUpgradeHandler.UpgradeCodec upgradeCodec, int maxContentLength)Constructs the client upgrade handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddecode(io.netty5.channel.ChannelHandlerContext ctx, HttpObject msg)io.netty5.util.concurrent.Future<Void>write(io.netty5.channel.ChannelHandlerContext ctx, Object msg)-
Methods inherited from class io.netty5.handler.codec.http.HttpObjectAggregator
aggregate, beginAggregation, closeAfterContinueResponse, exceptionCaught, finishAggregation, handleOversizedMessage, ignoreContentAfterContinueResponse, isAggregated, isContentLengthInvalid, isLastContentMessage, lengthForAggregation, lengthForContent, newContinueResponse, tryContentMessage, tryStartMessage
-
Methods inherited from class io.netty5.handler.codec.MessageAggregatorNew
acceptInboundMessage, channelInactive, channelReadComplete, ctx, handlerAdded, handlerRemoved, maxContentLength
-
-
-
-
Constructor Detail
-
HttpClientUpgradeHandler
public HttpClientUpgradeHandler(HttpClientUpgradeHandler.SourceCodec sourceCodec, HttpClientUpgradeHandler.UpgradeCodec upgradeCodec, int maxContentLength)
Constructs the client upgrade handler.- Parameters:
sourceCodec- the codec that is being used initially.upgradeCodec- the codec that the client would like to upgrade to.maxContentLength- the maximum length of the aggregated content.
-
-
Method Detail
-
write
public io.netty5.util.concurrent.Future<Void> write(io.netty5.channel.ChannelHandlerContext ctx, Object msg)
-
decode
protected void decode(io.netty5.channel.ChannelHandlerContext ctx, HttpObject msg) throws Exception- Overrides:
decodein classio.netty5.handler.codec.MessageAggregatorNew<HttpObject,HttpMessage,HttpContent<C extends HttpContent<C>>,FullHttpMessage<?>>- Throws:
Exception
-
-