Module bus.http

Class CoverHttp.Async

java.lang.Object
org.miaixz.bus.http.plugin.httpv.CoverHttp<CoverHttp.Async>
org.miaixz.bus.http.plugin.httpv.CoverHttp.Async
All Implemented Interfaces:
Cancelable
Enclosing class:
CoverHttp<C extends CoverHttp<?>>

public static class CoverHttp.Async extends CoverHttp<CoverHttp.Async>
A builder for asynchronous HTTP requests.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • Async

      public Async(Httpv htttpv, String url)
      Constructs a new asynchronous request builder.
      Parameters:
      htttpv - The Httpv instance.
      url - The request URL.
  • Method Details

    • setOnException

      public CoverHttp.Async setOnException(Callback<IOException> onException)
      Sets the callback for exceptions. When set, exceptions will not be thrown.
      Parameters:
      onException - The exception callback.
      Returns:
      This Async instance for chaining.
    • setOnComplete

      public CoverHttp.Async setOnComplete(Callback<CoverResult.State> onComplete)
      Sets the callback for when the request is complete (will be called in all cases).
      Parameters:
      onComplete - The completion callback.
      Returns:
      This Async instance for chaining.
    • setOnResponse

      public CoverHttp.Async setOnResponse(Callback<CoverResult> onResponse)
      Sets the callback for a successful HTTP response.
      Parameters:
      onResponse - The response callback.
      Returns:
      This Async instance for chaining.
    • get

      public GiveCall get()
      Executes an asynchronous GET request.
      Returns:
      A GiveCall object to control and get the result of the async call.
    • head

      public GiveCall head()
      Executes an asynchronous HEAD request.
      Returns:
      A GiveCall object to control and get the result of the async call.
    • post

      public GiveCall post()
      Executes an asynchronous POST request.
      Returns:
      A GiveCall object to control and get the result of the async call.
    • put

      public GiveCall put()
      Executes an asynchronous PUT request.
      Returns:
      A GiveCall object to control and get the result of the async call.
    • patch

      public GiveCall patch()
      Executes an asynchronous PATCH request.
      Returns:
      A GiveCall object to control and get the result of the async call.
    • delete

      public GiveCall delete()
      Executes an asynchronous DELETE request.
      Returns:
      A GiveCall object to control and get the result of the async call.
    • request

      public GiveCall request(String method)
      Executes an asynchronous HTTP request with the specified method.
      Parameters:
      method - The HTTP method.
      Returns:
      A GiveCall object to control and get the result of the async call.