- java.lang.Object
-
- io.netty5.handler.codec.http2.Http2ClientUpgradeCodec
-
- All Implemented Interfaces:
HttpClientUpgradeHandler.UpgradeCodec
@UnstableApi public class Http2ClientUpgradeCodec extends Object implements HttpClientUpgradeHandler.UpgradeCodec
Client-side clear-text upgrade codec from HTTP to HTTP/2.
-
-
Constructor Summary
Constructors Constructor Description Http2ClientUpgradeCodec(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(String handlerName, Http2ConnectionHandler connectionHandler)
Creates the codec providing an upgrade to the given handler for HTTP/2.Http2ClientUpgradeCodec(String handlerName, Http2ConnectionHandler connectionHandler, Http2MultiplexHandler http2MultiplexHandler)
Creates the codec providing an upgrade to the given handler for HTTP/2.Http2ClientUpgradeCodec(String handlerName, Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CharSequence
protocol()
Returns the name of the protocol supported by this codec, as indicated by the'UPGRADE'
header.Collection<CharSequence>
setUpgradeHeaders(ChannelHandlerContext ctx, HttpRequest upgradeRequest)
Sets any protocol-specific headers required to the upgrade request.void
upgradeTo(ChannelHandlerContext ctx, Send<FullHttpResponse> upgradeResponse)
Performs an HTTP protocol upgrade from the source codec.
-
-
-
Constructor Detail
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler)
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(String handlerName, Http2FrameCodec frameCodec, ChannelHandler upgradeToHandler)
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(Http2ConnectionHandler connectionHandler)
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(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, ornull
to auto-generate the nameconnectionHandler
- the HTTP/2 connection handler
-
Http2ClientUpgradeCodec
public Http2ClientUpgradeCodec(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, ornull
to auto-generate the nameconnectionHandler
- the HTTP/2 connection handler
-
-
Method Detail
-
protocol
public CharSequence protocol()
Description copied from interface:HttpClientUpgradeHandler.UpgradeCodec
Returns the name of the protocol supported by this codec, as indicated by the'UPGRADE'
header.- Specified by:
protocol
in interfaceHttpClientUpgradeHandler.UpgradeCodec
-
setUpgradeHeaders
public Collection<CharSequence> setUpgradeHeaders(ChannelHandlerContext ctx, HttpRequest upgradeRequest)
Description copied from interface:HttpClientUpgradeHandler.UpgradeCodec
Sets 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:
setUpgradeHeaders
in interfaceHttpClientUpgradeHandler.UpgradeCodec
-
upgradeTo
public void upgradeTo(ChannelHandlerContext ctx, Send<FullHttpResponse> upgradeResponse) throws Exception
Description copied from interface:HttpClientUpgradeHandler.UpgradeCodec
Performs an HTTP protocol upgrade from the source codec. This method is responsible for adding all handlers required for the new protocol.- Specified by:
upgradeTo
in 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:
Exception
-
-