Class CoreClientUpgradeRequest

java.lang.Object
org.eclipse.jetty.client.HttpRequest
org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest
All Implemented Interfaces:
EventListener, Request, Response.CompleteListener, Response.ResponseListener, HttpUpgrader.Factory
Direct Known Subclasses:
JakartaClientUpgradeRequest, JettyClientUpgradeRequest

public abstract class CoreClientUpgradeRequest extends HttpRequest implements Response.CompleteListener, HttpUpgrader.Factory
  • Field Details

  • Constructor Details

    • CoreClientUpgradeRequest

      public CoreClientUpgradeRequest(WebSocketCoreClient webSocketClient, URI requestURI)
  • Method Details

    • from

      public static CoreClientUpgradeRequest from(WebSocketCoreClient webSocketClient, URI requestURI, FrameHandler frameHandler)
    • setConfiguration

      public void setConfiguration(Configuration.ConfigurationCustomizer config)
    • addListener

      public void addListener(UpgradeListener listener)
    • addExtensions

      public void addExtensions(ExtensionConfig... configs)
    • addExtensions

      public void addExtensions(String... configs)
    • getExtensions

      public List<ExtensionConfig> getExtensions()
    • setExtensions

      public void setExtensions(List<ExtensionConfig> configs)
    • getSubProtocols

      public List<String> getSubProtocols()
    • setSubProtocols

      public void setSubProtocols(String... protocols)
    • setSubProtocols

      public void setSubProtocols(List<String> protocols)
    • send

      public void send(Response.CompleteListener listener)
      Description copied from interface: Request

      Sends this request and asynchronously notifies the given listener for response events.

      This method should be used when the application needs to be notified of the various response events as they happen, or when the application needs to efficiently manage the response content.

      The listener passed to this method may implement not only Response.CompleteListener but also other response listener interfaces, and all the events implemented will be notified. This allows application code to write a single listener class to handle all relevant events.

      Specified by:
      send in interface Request
      Overrides:
      send in class HttpRequest
      Parameters:
      listener - the listener that receives response events
    • sendAsync

      public CompletableFuture<CoreSession> sendAsync()
    • onComplete

      public void onComplete(Result result)
      Description copied from interface: Response.CompleteListener
      Callback method invoked when the request and the response have been processed, either successfully or not.

      The result parameter contains the request, the response, and eventual failures.

      Requests may complete after response, for example in case of big uploads that are discarded or read asynchronously by the server. This method is always invoked after Response.SuccessListener.onSuccess(Response) or Response.FailureListener.onFailure(Response, Throwable), and only when request indicates that it is completed.

      Specified by:
      onComplete in interface Response.CompleteListener
      Parameters:
      result - the result of the request / response exchange
    • handleException

      protected void handleException(Throwable failure)
    • newHttpUpgrader

      public HttpUpgrader newHttpUpgrader(HttpVersion version)
      Specified by:
      newHttpUpgrader in interface HttpUpgrader.Factory
    • customize

      protected void customize(EndPoint endPoint)
      Allow for overridden customization of endpoint (such as special transport level properties: e.g. TCP keepAlive)
    • getFrameHandler

      public abstract FrameHandler getFrameHandler()
    • requestComplete

      public void requestComplete()
    • upgrade

      public void upgrade(HttpResponse response, EndPoint endPoint)