Class WsProtocolProvider
java.lang.Object
org.jdrupes.httpcodec.plugin.UpgradeProvider
org.jdrupes.httpcodec.protocols.websocket.WsProtocolProvider
A protocol provider for the WebSocket protocol.
The web socket protocol is an upgrade from the HTTP protocol.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
augmentInitialRequest
(HttpRequest request) Add protocol specific information to a request with anUpgrade
header field.void
augmentInitialResponse
(HttpResponse response) Add any required information to the “switching protocols” response that is sent as the last package of the HTTP and starts the usage of the new protocol.void
checkSwitchingResponse
(HttpRequest request, HttpResponse response) Check the101 Switching Protocol
response for any problem indicators.Decoder<?,
?> createRequestDecoder
(String protocol) Creates a new request decoder for the protocol.Encoder<?,
?> createRequestEncoder
(String protocol) Creates a new request encoder for the protocol.Decoder<?,
?> createResponseDecoder
(String protocol) Creates a new response decoder for the protocol.Encoder<?,
?> createResponseEncoder
(String protocol) Creates a new response encoder for the protocol.boolean
supportsProtocol
(String protocol) Checks if the plugin supports the given protocol.
-
Constructor Details
-
WsProtocolProvider
public WsProtocolProvider()
-
-
Method Details
-
supportsProtocol
Description copied from class:UpgradeProvider
Checks if the plugin supports the given protocol.- Specified by:
supportsProtocol
in classUpgradeProvider
- Parameters:
protocol
- the protocol in question- Returns:
- the result
-
augmentInitialRequest
Description copied from class:UpgradeProvider
Add protocol specific information to a request with anUpgrade
header field.- Specified by:
augmentInitialRequest
in classUpgradeProvider
- Parameters:
request
- the request
-
checkSwitchingResponse
public void checkSwitchingResponse(HttpRequest request, HttpResponse response) throws ProtocolException Description copied from class:UpgradeProvider
Check the101 Switching Protocol
response for any problem indicators.- Specified by:
checkSwitchingResponse
in classUpgradeProvider
- Parameters:
request
- the requestresponse
- the response- Throws:
ProtocolException
- the protocol exception
-
augmentInitialResponse
Description copied from class:UpgradeProvider
Add any required information to the “switching protocols” response that is sent as the last package of the HTTP and starts the usage of the new protocol.- Specified by:
augmentInitialResponse
in classUpgradeProvider
- Parameters:
response
- the response
-
createRequestEncoder
Description copied from class:UpgradeProvider
Creates a new request encoder for the protocol.- Specified by:
createRequestEncoder
in classUpgradeProvider
- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the request encoder
-
createRequestDecoder
Description copied from class:UpgradeProvider
Creates a new request decoder for the protocol.- Specified by:
createRequestDecoder
in classUpgradeProvider
- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the request decoder
-
createResponseEncoder
Description copied from class:UpgradeProvider
Creates a new response encoder for the protocol.- Specified by:
createResponseEncoder
in classUpgradeProvider
- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the response encoder
-
createResponseDecoder
Description copied from class:UpgradeProvider
Creates a new response decoder for the protocol.- Specified by:
createResponseDecoder
in classUpgradeProvider
- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the response decoder
-