Module bus.http

Class HeadRequest

java.lang.Object
org.miaixz.bus.http.plugin.httpz.HttpRequest
org.miaixz.bus.http.plugin.httpz.HeadRequest

public class HeadRequest extends HttpRequest
Represents an HTTP HEAD request. This class encapsulates all the parameters and configuration for a HEAD request. HEAD requests are used to retrieve the headers for a resource without fetching the response body.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • HeadRequest

      public HeadRequest(String url, Object tag, Map<String,String> params, Map<String,String> headers, String id)
      Constructs a new HeadRequest.
      Parameters:
      url - The request URL.
      tag - A tag for this request, used for cancellation.
      params - The query parameters for the request.
      headers - The request headers.
      id - A unique identifier for this request.
  • Method Details

    • buildRequestBody

      protected RequestBody buildRequestBody()
      Builds the request body. For a HEAD request, the body is always null.
      Specified by:
      buildRequestBody in class HttpRequest
      Returns:
      Always returns null.
    • buildRequest

      protected Request buildRequest(RequestBody requestBody)
      Builds the final Httpd Request object.
      Specified by:
      buildRequest in class HttpRequest
      Parameters:
      requestBody - The request body, which will be null for a HEAD request.
      Returns:
      The constructed Request object.