java.lang.Object
org.miaixz.bus.http.plugin.httpz.HttpRequest
org.miaixz.bus.http.plugin.httpz.PutRequest
Represents an HTTP PUT request. This class encapsulates parameters and builds the appropriate
RequestBody,
handling URL-encoded forms, multipart file uploads, and raw body content.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields inherited from class org.miaixz.bus.http.plugin.httpz.HttpRequest
body, builder, encodedParams, headers, id, list, multipartBody, params, url -
Constructor Summary
ConstructorsConstructorDescriptionPutRequest(String url, Object tag, Map<String, String> params, Map<String, String> headers, List<MultipartFile> list, String body, MultipartBody multipartBody, String id) Constructs a newPutRequest. -
Method Summary
Modifier and TypeMethodDescriptionprotected RequestbuildRequest(RequestBody requestBody) Abstract method to be implemented by subclasses to construct the finalRequestobject with the correct HTTP method.protected RequestBodyBuilds the request body based on the provided parameters.Methods inherited from class org.miaixz.bus.http.plugin.httpz.HttpRequest
build, createRequest, createRequestBody, getId, headers
-
Constructor Details
-
PutRequest
public PutRequest(String url, Object tag, Map<String, String> params, Map<String, String> headers, List<MultipartFile> list, String body, MultipartBody multipartBody, String id) Constructs a newPutRequest.- Parameters:
url- The request URL.tag- A tag for this request.params- The form parameters.headers- The request headers.list- A list of files for multipart upload.body- A raw string for the request body.multipartBody- A pre-built multipart body.id- A unique identifier for this request.
-
-
Method Details
-
buildRequestBody
Builds the request body based on the provided parameters. The priority is as follows: 1. A pre-builtMultipartBodyif provided. 2. A newMultipartBodyif files are added. 3. A raw string body if provided. 4. A URL-encodedFormBodyas the default.- Specified by:
buildRequestBodyin classHttpRequest- Returns:
- The constructed
RequestBody.
-
buildRequest
Description copied from class:HttpRequestAbstract method to be implemented by subclasses to construct the finalRequestobject with the correct HTTP method.- Specified by:
buildRequestin classHttpRequest- Parameters:
requestBody- The request body to be used.- Returns:
- The final
Requestobject.
-