| Modifier and Type | Class and Description |
|---|---|
| public static interface | HttpServerUpgradeHandler.
The source codec that is used in the pipeline initially. |
| public static interface | HttpServerUpgradeHandler.
A codec that the source can be upgraded to. |
| public static interface | HttpServerUpgradeHandler.
Creates a new |
| public static class | HttpServerUpgradeHandler.
User event that is fired to notify about the completion of an HTTP upgrade to another protocol. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final HttpServerUpgradeHandler. | |
| private final HttpServerUpgradeHandler. | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | HttpServerUpgradeHandler(HttpServerUpgradeHandler.
the codec that is being used initially sourceCodec,the factory that creates a new upgrade codec
for one of the requested upgrade protocols upgradeCodecFactoryConstructs the upgrader with the supported codecs. |
| public | HttpServerUpgradeHandler(HttpServerUpgradeHandler.
the codec that is being used initially sourceCodec,the factory that creates a new upgrade codec
for one of the requested upgrade protocols upgradeCodecFactory,the maximum length of the content of an upgrade request maxContentLength)Constructs the upgrader with the supported codecs. |
| public | HttpServerUpgradeHandler(HttpServerUpgradeHandler.
the codec that is being used initially sourceCodec,the factory that creates a new upgrade codec
for one of the requested upgrade protocols upgradeCodecFactory,the maximum length of the content of an upgrade request maxContentLength, boolean validate the header names and values of the upgrade response. validateHeaders)Constructs the upgrader with the supported codecs. |
| Modifier and Type | Method and Description |
|---|---|
| private FullHttpResponse | createUpgradeResponse(BufferAllocator allocator, CharSequence upgradeProtocol)
Creates the 101 Switching Protocols response message. |
| protected void | decodeAndClose(final ChannelHandlerContext
the ctx, HttpObject ChannelHandlerContext which this MessageToMessageDecoder belongs tothe message to decode to another one msg)Overrides io. |
| protected boolean | shouldHandleUpgradeRequest(HttpRequest req)
Determines whether the specified upgrade |
| private static List | |
| private void | |
| private boolean | Returns: true if the upgrade occurred, otherwise false.the context for this handler. ctx, final FullHttpRequest the HTTP request. request)Attempts to upgrade to the protocol(s) identified by the |
| handlingUpgrade | back to summary |
|---|---|
| private boolean handlingUpgrade | |
| sourceCodec | back to summary |
|---|---|
| private final HttpServerUpgradeHandler. | |
| upgradeCodecFactory | back to summary |
|---|---|
| private final HttpServerUpgradeHandler. | |
| validateHeaders | back to summary |
|---|---|
| private final boolean validateHeaders | |
| HttpServerUpgradeHandler | back to summary |
|---|---|
| public HttpServerUpgradeHandler(HttpServerUpgradeHandler. Constructs the upgrader with the supported codecs.
The handler instantiated by this constructor will reject an upgrade request with non-empty content.
It should not be a concern because an upgrade request is most likely a GET request.
If you have a client that sends a non-GET upgrade request, please consider using
| |
| HttpServerUpgradeHandler | back to summary |
|---|---|
| public HttpServerUpgradeHandler(HttpServerUpgradeHandler. Constructs the upgrader with the supported codecs.
| |
| HttpServerUpgradeHandler | back to summary |
|---|---|
| public HttpServerUpgradeHandler(HttpServerUpgradeHandler. Constructs the upgrader with the supported codecs.
| |
| createUpgradeResponse | back to summary |
|---|---|
| private FullHttpResponse createUpgradeResponse(BufferAllocator allocator, CharSequence upgradeProtocol) Creates the 101 Switching Protocols response message. | |
| decodeAndClose | back to summary |
|---|---|
| protected void decodeAndClose(final ChannelHandlerContext ctx, HttpObject msg) throws Exception Overrides io. Doc from io. Decode from one message to another. This method will be called for each written message that can be handled by this decoder. The message will not be automatically disposed of after this call. Instead, the responsibility of ensuring that messages are disposed of falls upon the implementor of this method.
Subclasses that wish to have incoming messages automatically disposed of should instead override the
| |
| shouldHandleUpgradeRequest | back to summary |
|---|---|
| protected boolean shouldHandleUpgradeRequest(HttpRequest req) Determines whether the specified upgrade
| |
| splitHeader | back to summary |
|---|---|
| private static List Splits a comma-separated header value. The returned set is case-insensitive and contains each part with whitespace removed. | |
| tryUpgrade | back to summary |
|---|---|
| private void tryUpgrade(ChannelHandlerContext ctx, FullHttpRequest request) | |
| upgrade | back to summary |
|---|---|
| private boolean upgrade(final ChannelHandlerContext ctx, final FullHttpRequest request) Attempts to upgrade to the protocol(s) identified by the
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | upgradeFrom(ChannelHandlerContext ctx)
Removes this codec (i.e. all associated handlers) from the pipeline. |
| upgradeFrom | back to summary |
|---|---|
| public void upgradeFrom(ChannelHandlerContext ctx) Removes this codec (i.e. all associated handlers) from the pipeline. | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, HttpHeaders upgradeHeaders)
Prepares the |
| public Collection | requiredUpgradeHeaders()
Gets all protocol-specific headers required by this protocol for a successful upgrade. |
| public void | upgradeTo(ChannelHandlerContext
the context for the current handler. ctx, FullHttpRequest the request that triggered the upgrade to this protocol. upgradeRequest)Performs an HTTP protocol upgrade from the source codec. |
| prepareUpgradeResponse | back to summary |
|---|---|
| public boolean prepareUpgradeResponse(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest, HttpHeaders upgradeHeaders) Prepares the | |
| requiredUpgradeHeaders | back to summary |
|---|---|
| public Collection Gets all protocol-specific headers required by this protocol for a successful upgrade.
Any supplied header will be required to appear in the | |
| upgradeTo | back to summary |
|---|---|
| public void upgradeTo(ChannelHandlerContext ctx, FullHttpRequest upgradeRequest) Performs an HTTP protocol upgrade from the source codec. This method is responsible for adding all handlers required for the new protocol.
| |
UpgradeCodec for the requested protocol name.
| Modifier and Type | Method and Description |
|---|---|
| public HttpServerUpgradeHandler. | newUpgradeCodec(CharSequence protocol)
Invoked by |
| newUpgradeCodec | back to summary |
|---|---|
| public HttpServerUpgradeHandler. Invoked by
| |
| Modifier and Type | Field and Description |
|---|---|
| private final CharSequence | |
| private final FullHttpRequest |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public HttpServerUpgradeHandler. | |
| public boolean | |
| public CharSequence | |
| public Send | send()
Implements io. |
| public String | |
| public HttpServerUpgradeHandler. | touch(Object
An optional hint about this access and its context. May be hint)null.Overrides default io. |
| public FullHttpRequest |
| protocol | back to summary |
|---|---|
| private final CharSequence protocol | |
| upgradeRequest | back to summary |
|---|---|
| private final FullHttpRequest upgradeRequest | |
| UpgradeEvent | back to summary |
|---|---|
| pack-priv UpgradeEvent(CharSequence protocol, FullHttpRequest upgradeRequest) | |
| close | back to summary |
|---|---|
| public void close() Implements io. Doc from io. Close the resource, making it inaccessible. Note, this method is not thread-safe unless otherwise specified.
| |
| copy | back to summary |
|---|---|
| public HttpServerUpgradeHandler. | |
| isAccessible | back to summary |
|---|---|
| public boolean isAccessible() Implements io. Doc from io. Check if this object is accessible. | |
| protocol | back to summary |
|---|---|
| public CharSequence protocol() The protocol that the channel has been upgraded to. | |
| send | back to summary |
|---|---|
| public Send Implements io. Doc from io. Send this object instance to another Thread, transferring the ownership to the recipient. The object must be in a state where it can be sent, which includes at least being accessible. When sent, this instance will immediately become inaccessible, as if by closing it. All attempts at accessing an object that has been sent, even if that object has not yet been received, should cause an exception to be thrown.
Calling
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| touch | back to summary |
|---|---|
| public HttpServerUpgradeHandler. Overrides default io. Doc from io. Record the current access location for debugging purposes. This information may be included if the resource throws a life-cycle related exception, or if it leaks. If this resource has already been closed, then this method has no effect.
| |
| upgradeRequest | back to summary |
|---|---|
| public FullHttpRequest upgradeRequest() Gets the request that triggered the protocol upgrade. | |