Package org.miaixz.bus.http
Class Request.Builder
java.lang.Object
org.miaixz.bus.http.Request.Builder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a header withnameandvalue.build()cacheControl(CacheControl cacheControl) Sets this request'sCache-Controlheader, replacing any cache control headers already present.delete()delete(RequestBody body) get()head()Sets the header namednametovalue.Removes all headers on this builder and addsheaders.method(String method, RequestBody body) patch(RequestBody body) post(RequestBody body) put(RequestBody body) removeHeader(String name) Removes all headers namednameon this builder.<T> Request.BuilderAttachestagto the request usingtypeas a key.Attachestagto the request usingObject.classas a key.Sets the URL target of this request.Sets the URL target of this request.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
url
-
url
Sets the URL target of this request.- Throws:
IllegalArgumentException- ifurlis not a valid HTTP or HTTPS URL. Avoid this exception by callingUnoUrl.parse(java.lang.String); it returns null for invalid URLs.
-
url
Sets the URL target of this request.- Throws:
IllegalArgumentException- if the scheme ofurlis nothttporhttps.
-
header
Sets the header namednametovalue. If this request already has any headers with that name, they are all replaced. -
addHeader
Adds a header withnameandvalue. Prefer this method for multiply-valued headers like "Cookie".Note that for some headers including
Content-LengthandContent-Encoding, Http may replacevaluewith a header derived from the request body. -
removeHeader
Removes all headers namednameon this builder. -
headers
Removes all headers on this builder and addsheaders. -
cacheControl
Sets this request'sCache-Controlheader, replacing any cache control headers already present. IfcacheControldoesn't define any directives, this clears this request's cache-control headers. -
get
-
head
-
post
-
delete
-
delete
-
put
-
patch
-
method
-
tag
Attachestagto the request usingObject.classas a key. -
tag
Attachestagto the request usingtypeas a key. Tags can be read from a request usingRequest.tag(). Use null to remove any existing tag assigned fortype.Use this API to attach timing, debugging, or other application data to a request so that you may read it in interceptors, event listeners, or callbacks.
-
build
-