Class UpgradeProvider

java.lang.Object
org.jdrupes.httpcodec.plugin.UpgradeProvider
Direct Known Subclasses:
WsProtocolProvider

public abstract class UpgradeProvider extends Object
The base class for a protocol that the HTTP connection can be upgraded to.
  • Constructor Details

  • Method Details

    • supportsProtocol

      public abstract boolean supportsProtocol(String protocol)
      Checks if the plugin supports the given protocol.
      Parameters:
      protocol - the protocol in question
      Returns:
      the result
    • augmentInitialRequest

      public abstract void augmentInitialRequest(HttpRequest request)
      Add protocol specific information to a request with an Upgrade header field.
      Parameters:
      request - the request
    • checkSwitchingResponse

      public abstract void checkSwitchingResponse(HttpRequest request, HttpResponse response) throws ProtocolException
      Check the 101 Switching Protocol response for any problem indicators.
      Parameters:
      request - the request
      response - the response
      Throws:
      ProtocolException - the protocol exception
    • augmentInitialResponse

      public 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.
      Parameters:
      response - the response
    • createRequestEncoder

      public abstract Encoder<?,?> createRequestEncoder(String protocol)
      Creates a new request encoder for the protocol.
      Parameters:
      protocol - the protocol, which must be supported by this plugin
      Returns:
      the request encoder
    • createRequestDecoder

      public abstract Decoder<?,?> createRequestDecoder(String protocol)
      Creates a new request decoder for the protocol.
      Parameters:
      protocol - the protocol, which must be supported by this plugin
      Returns:
      the request decoder
    • createResponseEncoder

      public abstract Encoder<?,?> createResponseEncoder(String protocol)
      Creates a new response encoder for the protocol.
      Parameters:
      protocol - the protocol, which must be supported by this plugin
      Returns:
      the response encoder
    • createResponseDecoder

      public abstract Decoder<?,?> createResponseDecoder(String protocol)
      Creates a new response decoder for the protocol.
      Parameters:
      protocol - the protocol, which must be supported by this plugin
      Returns:
      the response decoder