Class HttpRequest.Builder
java.lang.Object
org.eclipse.rdf4j.http.client.spi.HttpRequest.Builder
- Enclosing class:
HttpRequest
Builder for
HttpRequest.
The HTTP method and target URI are required and must be supplied at construction time via
HttpRequest.newBuilder(String, URI). Headers and body are optional and may be added incrementally before
calling build().
-
Method Summary
Modifier and TypeMethodDescriptionbody(HttpRequestBody body) Sets the request body.build()Builds and returns the immutableHttpRequest.Appends a single header to the request.headers(List<HttpHeader> hdrs) Appends all headers from the given list to the request.headers(HttpHeader... hdrs) Appends one or more headers to the request.responseTimeout(Duration timeout) Sets the response timeout for this request.
-
Method Details
-
header
Appends a single header to the request. Multiple calls with the same name are additive; no deduplication is performed.- Parameters:
name- the header name; must not benullvalue- the header value; must not benull- Returns:
- this builder
-
headers
Appends all headers from the given list to the request. Multiple calls are additive.- Parameters:
hdrs- the list ofHttpHeaders to add; must not benull- Returns:
- this builder
-
headers
Appends one or more headers to the request. Multiple calls are additive.- Parameters:
hdrs- theHttpHeaders to add; must not benull- Returns:
- this builder
-
body
Sets the request body. Passnullor omit this call for bodyless requests (e.g.GET,DELETE).- Parameters:
body- theHttpRequestBodyto set, ornullfor no body- Returns:
- this builder
-
responseTimeout
Sets the response timeout for this request. When set, the HTTP client must abort the request if no response data arrives within this duration, overriding any client-level socket timeout. Passnullto clear a previously set timeout.- Parameters:
timeout- the response timeout, ornullfor no per-request timeout- Returns:
- this builder
-
build
-