@UnstableApi public class Http2ClientUpgradeCodec extends java.lang.Object implements HttpClientUpgradeHandler.UpgradeCodec
| Modifier and Type | Field and Description |
|---|---|
private Http2ConnectionHandler |
connectionHandler |
private java.lang.String |
handlerName |
private static java.util.List<java.lang.CharSequence> |
UPGRADE_HEADERS |
| Constructor and Description |
|---|
Http2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler)
Creates the codec using a default name for the connection handler when adding to the
pipeline.
|
Http2ClientUpgradeCodec(java.lang.String handlerName,
Http2ConnectionHandler connectionHandler)
Creates the codec providing an upgrade to the given handler for HTTP/2.
|
| Modifier and Type | Method and Description |
|---|---|
private java.lang.CharSequence |
getSettingsHeaderValue(ChannelHandlerContext ctx)
Converts the current settings for the handler to the Base64-encoded representation used in
the HTTP2-Settings upgrade header.
|
java.lang.CharSequence |
protocol()
Returns the name of the protocol supported by this codec, as indicated by the
'UPGRADE' header. |
java.util.Collection<java.lang.CharSequence> |
setUpgradeHeaders(ChannelHandlerContext ctx,
HttpRequest upgradeRequest)
Sets any protocol-specific headers required to the upgrade request.
|
void |
upgradeTo(ChannelHandlerContext ctx,
FullHttpResponse upgradeResponse)
Performs an HTTP protocol upgrade from the source codec.
|
private static final java.util.List<java.lang.CharSequence> UPGRADE_HEADERS
private final java.lang.String handlerName
private final Http2ConnectionHandler connectionHandler
public Http2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler)
connectionHandler - the HTTP/2 connection handlerpublic Http2ClientUpgradeCodec(java.lang.String handlerName,
Http2ConnectionHandler connectionHandler)
handlerName - the name of the HTTP/2 connection handler to be used in the pipeline,
or null to auto-generate the nameconnectionHandler - the HTTP/2 connection handlerpublic java.lang.CharSequence protocol()
HttpClientUpgradeHandler.UpgradeCodec'UPGRADE' header.protocol in interface HttpClientUpgradeHandler.UpgradeCodecpublic java.util.Collection<java.lang.CharSequence> setUpgradeHeaders(ChannelHandlerContext ctx, HttpRequest upgradeRequest)
HttpClientUpgradeHandler.UpgradeCodecsetUpgradeHeaders in interface HttpClientUpgradeHandler.UpgradeCodecpublic void upgradeTo(ChannelHandlerContext ctx, FullHttpResponse upgradeResponse) throws java.lang.Exception
HttpClientUpgradeHandler.UpgradeCodecupgradeTo in interface HttpClientUpgradeHandler.UpgradeCodecctx - the context for the current handler.upgradeResponse - the 101 Switching Protocols response that indicates that the server
has switched to this protocol.java.lang.Exceptionprivate java.lang.CharSequence getSettingsHeaderValue(ChannelHandlerContext ctx)