static final class HttpBuilder.RequestSpec
extends Object
Per-request configuration DSL used by the request methods.
| Type | Name and description |
|---|---|
Object |
bodyRequest body value after any DSL serialization step. |
HttpResponse.BodyHandler<String> |
bodyHandlerBody handler used for buffered requests. |
Map<String, String> |
headersHeaders added only to the current request. |
Map<String, Object> |
queryParametersQuery parameters appended to the current request URI. |
Duration |
timeoutRequest-specific timeout overriding the builder default. |
| Constructor and description |
|---|
HttpBuilder.RequestSpec() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
asString()Uses the default string body handler for buffered requests. |
|
void |
body(Object value)Sets the request body without further serialization. |
|
void |
bytes(byte[] value)Sets the request body to raw bytes. |
|
void |
form(Map<String, ?> values)Encodes map entries as application/x-www-form-urlencoded and sets a default content type. |
|
void |
header(String name, Object value)Adds a header to the current request. |
|
void |
headers(Map<String, ?> values)Adds multiple headers to the current request. |
|
void |
json(Object value)Serializes the given value as JSON and sets a default content type. |
|
void |
query(String name, Object value)Adds a query parameter to the current request. |
|
void |
query(Map<String, ?> values)Adds multiple query parameters to the current request. |
|
void |
text(Object value)Sets the request body to the string form of the supplied value. |
|
void |
timeout(Duration value)Sets the timeout for the current request. |
Request body value after any DSL serialization step.
Body handler used for buffered requests.
Request-specific timeout overriding the builder default.
Uses the default string body handler for buffered requests.
Sets the request body without further serialization.
value - the body valueSets the request body to raw bytes.
value - the binary payloadEncodes map entries as application/x-www-form-urlencoded and sets a default content type.
values - the form fields to encodeAdds a header to the current request.
name - the header namevalue - the header valueAdds multiple headers to the current request.
values - the headers to addSerializes the given value as JSON and sets a default content type.
value - the value to serializeAdds a query parameter to the current request.
name - the query parameter namevalue - the query parameter valueAdds multiple query parameters to the current request.
values - the query parameters to addSets the request body to the string form of the supplied value.
value - the text body valueSets the timeout for the current request.
value - the request timeoutCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.