Class Http2ClientUpgradeCodec
java.lang.Object
io.netty.handler.codec.http2.Http2ClientUpgradeCodec
- All Implemented Interfaces:
HttpClientUpgradeHandler.UpgradeCodec
public class Http2ClientUpgradeCodec
extends java.lang.Object
implements HttpClientUpgradeHandler.UpgradeCodec
Client-side cleartext upgrade codec from HTTP to HTTP/2.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Http2ConnectionHandlerprivate final java.lang.Stringprivate final ChannelHandlerprivate static final java.util.List<java.lang.CharSequence> private final ChannelHandler -
Constructor Summary
ConstructorsModifierConstructorDescriptionHttp2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler) Creates the codec using a default name for the connection handler when adding to the pipeline.Http2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler, Http2MultiplexHandler http2MultiplexHandler) Creates the codec using a default name for the connection handler when adding to the pipeline.Http2ClientUpgradeCodec(Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler) Http2ClientUpgradeCodec(java.lang.String handlerName, Http2ConnectionHandler connectionHandler) Creates the codec providing an upgrade to the given handler for HTTP/2.privateHttp2ClientUpgradeCodec(java.lang.String handlerName, Http2ConnectionHandler connectionHandler, ChannelHandler upgradeToHandler, Http2MultiplexHandler http2MultiplexHandler) Http2ClientUpgradeCodec(java.lang.String handlerName, Http2ConnectionHandler connectionHandler, Http2MultiplexHandler http2MultiplexHandler) Creates the codec providing an upgrade to the given handler for HTTP/2.Http2ClientUpgradeCodec(java.lang.String handlerName, Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler) -
Method Summary
Modifier and TypeMethodDescriptionprivate java.lang.CharSequenceConverts the current settings for the handler to the Base64-encoded representation used in the HTTP2-Settings upgrade header.java.lang.CharSequenceprotocol()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.voidupgradeTo(ChannelHandlerContext ctx, FullHttpResponse upgradeResponse) Performs an HTTP protocol upgrade from the source codec.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
UPGRADE_HEADERS
private static final java.util.List<java.lang.CharSequence> UPGRADE_HEADERS -
handlerName
private final java.lang.String handlerName -
connectionHandler
-
upgradeToHandler
-
http2MultiplexHandler
-
-
Constructor Details
-
Http2ClientUpgradeCodec
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(java.lang.String handlerName, Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler) -
Http2ClientUpgradeCodec
Creates the codec using a default name for the connection handler when adding to the pipeline.- Parameters:
connectionHandler- the HTTP/2 connection handler
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler, Http2MultiplexHandler http2MultiplexHandler) Creates the codec using a default name for the connection handler when adding to the pipeline.- Parameters:
connectionHandler- the HTTP/2 connection handlerhttp2MultiplexHandler- the Http2 Multiplexer handler to work with Http2FrameCodec
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(java.lang.String handlerName, Http2ConnectionHandler connectionHandler) Creates the codec providing an upgrade to the given handler for HTTP/2.- Parameters:
handlerName- the name of the HTTP/2 connection handler to be used in the pipeline, ornullto auto-generate the nameconnectionHandler- the HTTP/2 connection handler
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(java.lang.String handlerName, Http2ConnectionHandler connectionHandler, Http2MultiplexHandler http2MultiplexHandler) Creates the codec providing an upgrade to the given handler for HTTP/2.- Parameters:
handlerName- the name of the HTTP/2 connection handler to be used in the pipeline, ornullto auto-generate the nameconnectionHandler- the HTTP/2 connection handler
-
Http2ClientUpgradeCodec
private Http2ClientUpgradeCodec(java.lang.String handlerName, Http2ConnectionHandler connectionHandler, ChannelHandler upgradeToHandler, Http2MultiplexHandler http2MultiplexHandler)
-
-
Method Details
-
protocol
public java.lang.CharSequence protocol()Description copied from interface:HttpClientUpgradeHandler.UpgradeCodecReturns the name of the protocol supported by this codec, as indicated by the'UPGRADE'header.- Specified by:
protocolin interfaceHttpClientUpgradeHandler.UpgradeCodec
-
setUpgradeHeaders
public java.util.Collection<java.lang.CharSequence> setUpgradeHeaders(ChannelHandlerContext ctx, HttpRequest upgradeRequest) Description copied from interface:HttpClientUpgradeHandler.UpgradeCodecSets any protocol-specific headers required to the upgrade request. Returns the names of all headers that were added. These headers will be used to populate the CONNECTION header.- Specified by:
setUpgradeHeadersin interfaceHttpClientUpgradeHandler.UpgradeCodec
-
upgradeTo
public void upgradeTo(ChannelHandlerContext ctx, FullHttpResponse upgradeResponse) throws java.lang.Exception Description copied from interface:HttpClientUpgradeHandler.UpgradeCodecPerforms an HTTP protocol upgrade from the source codec. This method is responsible for adding all handlers required for the new protocol.- Specified by:
upgradeToin interfaceHttpClientUpgradeHandler.UpgradeCodec- Parameters:
ctx- the context for the current handler.upgradeResponse- the 101 Switching Protocols response that indicates that the server has switched to this protocol.- Throws:
java.lang.Exception
-
getSettingsHeaderValue
Converts the current settings for the handler to the Base64-encoded representation used in the HTTP2-Settings upgrade header.
-