Package io.netty.handler.codec.http
Interface HttpServerUpgradeHandler.UpgradeCodec
- Enclosing class:
HttpServerUpgradeHandler
public static interface HttpServerUpgradeHandler.UpgradeCodec
A codec that the source can be upgraded to.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanprepareUpgradeResponse(io.netty.channel.ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, HttpHeaders upgradeHeaders) Prepares theupgradeHeadersfor a protocol update based upon the contents ofupgradeRequest.Gets all protocol-specific headers required by this protocol for a successful upgrade.voidupgradeTo(io.netty.channel.ChannelHandlerContext ctx, FullHttpRequest upgradeRequest) Performs an HTTP protocol upgrade from the source codec.
-
Method Details
-
requiredUpgradeHeaders
Collection<CharSequence> requiredUpgradeHeaders()Gets all protocol-specific headers required by this protocol for a successful upgrade. Any supplied header will be required to appear in theHttpHeaderNames.CONNECTIONheader as well. -
prepareUpgradeResponse
boolean prepareUpgradeResponse(io.netty.channel.ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, HttpHeaders upgradeHeaders) Prepares theupgradeHeadersfor a protocol update based upon the contents ofupgradeRequest. This method returns a boolean value to proceed or abort the upgrade in progress. Iffalseis returned, the upgrade is aborted and theupgradeRequestwill be passed through the inbound pipeline as if no upgrade was performed. Iftrueis returned, the upgrade will proceed to the next step which invokesupgradeTo(io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.http.FullHttpRequest). When returningtrue, you can add headers to theupgradeHeadersso that they are added to the 101 Switching protocols response. -
upgradeTo
Performs an HTTP protocol upgrade from the source codec. This method is responsible for adding all handlers required for the new protocol.- Parameters:
ctx- the context for the current handler.upgradeRequest- the request that triggered the upgrade to this protocol.
-