public static interface HttpServerUpgradeHandler.UpgradeCodec
Modifier and Type | Method and Description |
---|---|
boolean |
prepareUpgradeResponse(ChannelHandlerContext ctx,
FullHttpRequest upgradeRequest,
HttpHeaders upgradeHeaders)
Prepares the
upgradeHeaders for a protocol update based upon the contents of upgradeRequest . |
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.
|
Collection<CharSequence> requiredUpgradeHeaders()
HttpHeaderNames.CONNECTION
header as well.boolean prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, HttpHeaders upgradeHeaders)
upgradeHeaders
for a protocol update based upon the contents of upgradeRequest
.
This method returns a boolean value to proceed or abort the upgrade in progress. If false
is
returned, the upgrade is aborted and the upgradeRequest
will be passed through the inbound pipeline
as if no upgrade was performed. If true
is returned, the upgrade will proceed to the next
step which invokes upgradeTo(io.netty.channel.ChannelHandlerContext, io.netty.handler.codec.http.FullHttpRequest)
. When returning true
, you can add headers to
the upgradeHeaders
so that they are added to the 101 Switching protocols response.void upgradeTo(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest)
ctx
- the context for the current handler.upgradeRequest
- the request that triggered the upgrade to this protocol.Copyright © 2008–2024 The Netty Project. All rights reserved.