Class ProtocolHttpUpgrader

java.lang.Object
org.eclipse.jetty.client.http.ProtocolHttpUpgrader
All Implemented Interfaces:
HttpUpgrader

public class ProtocolHttpUpgrader extends Object implements HttpUpgrader

A HttpUpgrader that upgrades to a given protocol.

Works in conjunction with HttpClientTransportDynamic so that the protocol to upgrade to must be one of the application protocols supported by HttpClientTransportDynamic.

  • Constructor Details

  • Method Details

    • prepare

      public void prepare(HttpRequest request)
      Description copied from interface: HttpUpgrader

      Prepares the request for the upgrade, for example by setting the HTTP method or by setting HTTP headers required for the upgrade.

      Specified by:
      prepare in interface HttpUpgrader
      Parameters:
      request - the request to prepare
    • upgrade

      public void upgrade(HttpResponse response, EndPoint endPoint, Callback callback)
      Description copied from interface: HttpUpgrader

      Upgrades the given endPoint to a different protocol.

      The success or failure of the upgrade should be communicated via the given callback.

      An exception thrown by this method is equivalent to failing the callback.

      Specified by:
      upgrade in interface HttpUpgrader
      Parameters:
      response - the response with the information about the upgrade
      endPoint - the EndPoint to upgrade
      callback - a callback to notify of the success or failure of the upgrade