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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaugmentInitialRequest(HttpRequest request) Add protocol specific information to a request with anUpgradeheader field.abstract voidaugmentInitialResponse(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 voidcheckSwitchingResponse(HttpRequest request, HttpResponse response) Check the101 Switching Protocolresponse 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 booleansupportsProtocol(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 anUpgradeheader field.- Parameters:
request- the request
-
checkSwitchingResponse
public abstract void checkSwitchingResponse(HttpRequest request, HttpResponse response) throws ProtocolException Check the101 Switching Protocolresponse 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
-