Package org.jdrupes.httpcodec.plugin
Class UpgradeProvider
java.lang.Object
org.jdrupes.httpcodec.plugin.UpgradeProvider
- Direct Known Subclasses:
WsProtocolProvider
The base class for a protocol that the HTTP connection
can be upgraded to.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
augmentInitialRequest
(HttpRequest request) Add protocol specific information to a request with anUpgrade
header field.abstract 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.abstract void
checkSwitchingResponse
(HttpRequest request, HttpResponse response) Check the101 Switching Protocol
response for any problem indicators.abstract Decoder<?,
?> createRequestDecoder
(String protocol) Creates a new request decoder for the protocol.abstract Encoder<?,
?> createRequestEncoder
(String protocol) Creates a new request encoder for the protocol.abstract Decoder<?,
?> createResponseDecoder
(String protocol) Creates a new response decoder for the protocol.abstract Encoder<?,
?> createResponseEncoder
(String protocol) Creates a new response encoder for the protocol.abstract boolean
supportsProtocol
(String protocol) Checks if the plugin supports the given protocol.
-
Constructor Details
-
UpgradeProvider
public UpgradeProvider()
-
-
Method Details
-
supportsProtocol
Checks if the plugin supports the given protocol.- Parameters:
protocol
- the protocol in question- Returns:
- the result
-
augmentInitialRequest
Add protocol specific information to a request with anUpgrade
header field.- Parameters:
request
- the request
-
checkSwitchingResponse
public abstract void checkSwitchingResponse(HttpRequest request, HttpResponse response) throws ProtocolException Check the101 Switching Protocol
response for any problem indicators.- Parameters:
request
- the requestresponse
- the response- Throws:
ProtocolException
- the protocol exception
-
augmentInitialResponse
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.- Parameters:
response
- the response
-
createRequestEncoder
Creates a new request encoder for the protocol.- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the request encoder
-
createRequestDecoder
Creates a new request decoder for the protocol.- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the request decoder
-
createResponseEncoder
Creates a new response encoder for the protocol.- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the response encoder
-
createResponseDecoder
Creates a new response decoder for the protocol.- Parameters:
protocol
- the protocol, which must be supported by this plugin- Returns:
- the response decoder
-