public class Http2ServerUpgradeCodec extends Object implements HttpServerUpgradeHandler.UpgradeCodec
Constructor and Description |
---|
Http2ServerUpgradeCodec(Http2ConnectionHandler connectionHandler)
Creates the codec using a default name for the connection handler when adding to the
pipeline.
|
Http2ServerUpgradeCodec(String handlerName,
Http2ConnectionHandler connectionHandler)
Creates the codec providing an upgrade to the given handler for HTTP/2.
|
Modifier and Type | Method and Description |
---|---|
void |
prepareUpgradeResponse(ChannelHandlerContext ctx,
FullHttpRequest upgradeRequest,
FullHttpResponse upgradeResponse)
Adds any headers to the 101 Switching protocols response that are appropriate for this protocol.
|
String |
protocol()
Returns the name of the protocol supported by this codec, as indicated by the
HttpHeaderNames.UPGRADE header. |
Collection<String> |
requiredUpgradeHeaders()
Gets all protocol-specific headers required by this protocol for a successful upgrade.
|
void |
upgradeTo(ChannelHandlerContext ctx,
FullHttpRequest upgradeRequest,
FullHttpResponse upgradeResponse)
Performs an HTTP protocol upgrade from the source codec.
|
public Http2ServerUpgradeCodec(Http2ConnectionHandler connectionHandler)
connectionHandler
- the HTTP/2 connection handler.public Http2ServerUpgradeCodec(String handlerName, Http2ConnectionHandler connectionHandler)
handlerName
- the name of the HTTP/2 connection handler to be used in the pipeline.connectionHandler
- the HTTP/2 connection handler.public String protocol()
HttpServerUpgradeHandler.UpgradeCodec
HttpHeaderNames.UPGRADE
header.protocol
in interface HttpServerUpgradeHandler.UpgradeCodec
public Collection<String> requiredUpgradeHeaders()
HttpServerUpgradeHandler.UpgradeCodec
HttpHeaderNames.CONNECTION
header as well.requiredUpgradeHeaders
in interface HttpServerUpgradeHandler.UpgradeCodec
public void prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, FullHttpResponse upgradeResponse)
HttpServerUpgradeHandler.UpgradeCodec
prepareUpgradeResponse
in interface HttpServerUpgradeHandler.UpgradeCodec
public void upgradeTo(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, FullHttpResponse upgradeResponse)
HttpServerUpgradeHandler.UpgradeCodec
upgradeTo
in interface HttpServerUpgradeHandler.UpgradeCodec
ctx
- the context for the current handler.upgradeRequest
- the request that triggered the upgrade to this protocol. The
upgraded protocol is responsible for sending the response.upgradeResponse
- a 101 Switching Protocols response that is populated with the
HttpHeaderNames.CONNECTION
and HttpHeaderNames.UPGRADE
headers.
The protocol is required to send this before sending any other frames back to the client.
The headers may be augmented as necessary by the protocol before sending.Copyright © 2008–2015 The Netty Project. All rights reserved.