Module io.netty5.codec.http
Package io.netty5.handler.codec.http
Interface HttpServerUpgradeHandler.UpgradeCodec
-
- All Known Implementing Classes:
Http2ServerUpgradeCodec
- Enclosing class:
- HttpServerUpgradeHandler<C extends HttpContent<C>>
public static interface HttpServerUpgradeHandler.UpgradeCodec
A codec that the source can be upgraded to.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, HttpHeaders upgradeHeaders)
Prepares theupgradeHeaders
for a protocol update based upon the contents ofupgradeRequest
.Collection<CharSequence>
requiredUpgradeHeaders()
Gets all protocol-specific headers required by this protocol for a successful upgrade.void
upgradeTo(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest)
Performs an HTTP protocol upgrade from the source codec.
-
-
-
Method Detail
-
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.CONNECTION
header as well.
-
prepareUpgradeResponse
boolean prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, HttpHeaders upgradeHeaders)
Prepares theupgradeHeaders
for a protocol update based upon the contents ofupgradeRequest
. This method returns a boolean value to proceed or abort the upgrade in progress. Iffalse
is returned, the upgrade is aborted and theupgradeRequest
will be passed through the inbound pipeline as if no upgrade was performed. Iftrue
is returned, the upgrade will proceed to the next step which invokesupgradeTo(io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.http.FullHttpRequest)
. When returningtrue
, you can add headers to theupgradeHeaders
so that they are added to the 101 Switching protocols response.
-
upgradeTo
void upgradeTo(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest)
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.
-
-