private static class RequestEntity.DefaultBodyBuilder extends java.lang.Object implements RequestEntity.BodyBuilder
Modifier and Type | Field and Description |
---|---|
private HttpHeaders |
headers |
private HttpMethod |
method |
private java.net.URI |
url |
Constructor and Description |
---|
DefaultBodyBuilder(HttpMethod method,
java.net.URI url) |
Modifier and Type | Method and Description |
---|---|
RequestEntity.BodyBuilder |
accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept header. |
RequestEntity.BodyBuilder |
acceptCharset(java.nio.charset.Charset... acceptableCharsets)
Set the list of acceptable charsets, as specified
by the
Accept-Charset header. |
<T> RequestEntity<T> |
body(T body)
Set the body of the request entity and build the RequestEntity.
|
<T> RequestEntity<T> |
body(T body,
java.lang.reflect.Type type)
Set the body and type of the request entity and build the RequestEntity.
|
RequestEntity<java.lang.Void> |
build()
Builds the request entity with no body.
|
RequestEntity.BodyBuilder |
contentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
RequestEntity.BodyBuilder |
contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
RequestEntity.BodyBuilder |
header(java.lang.String headerName,
java.lang.String... headerValues)
Add the given, single header value under the given name.
|
RequestEntity.BodyBuilder |
ifModifiedSince(java.time.Instant ifModifiedSince)
Set the value of the
If-Modified-Since header. |
RequestEntity.BodyBuilder |
ifModifiedSince(long ifModifiedSince)
Set the value of the
If-Modified-Since header. |
RequestEntity.BodyBuilder |
ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
Set the value of the
If-Modified-Since header. |
RequestEntity.BodyBuilder |
ifNoneMatch(java.lang.String... ifNoneMatches)
Set the values of the
If-None-Match header. |
private final HttpMethod method
private final java.net.URI url
private final HttpHeaders headers
public DefaultBodyBuilder(HttpMethod method, java.net.URI url)
public RequestEntity.BodyBuilder header(java.lang.String headerName, java.lang.String... headerValues)
RequestEntity.HeadersBuilder
header
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
headerName
- the header nameheaderValues
- the header value(s)HttpHeaders.add(String, String)
public RequestEntity.BodyBuilder accept(MediaType... acceptableMediaTypes)
RequestEntity.HeadersBuilder
Accept
header.accept
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
acceptableMediaTypes
- the acceptable media typespublic RequestEntity.BodyBuilder acceptCharset(java.nio.charset.Charset... acceptableCharsets)
RequestEntity.HeadersBuilder
Accept-Charset
header.acceptCharset
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
acceptableCharsets
- the acceptable charsetspublic RequestEntity.BodyBuilder contentLength(long contentLength)
RequestEntity.BodyBuilder
Content-Length
header.contentLength
in interface RequestEntity.BodyBuilder
contentLength
- the content lengthHttpHeaders.setContentLength(long)
public RequestEntity.BodyBuilder contentType(MediaType contentType)
RequestEntity.BodyBuilder
Content-Type
header.contentType
in interface RequestEntity.BodyBuilder
contentType
- the content typeHttpHeaders.setContentType(MediaType)
public RequestEntity.BodyBuilder ifModifiedSince(java.time.ZonedDateTime ifModifiedSince)
RequestEntity.HeadersBuilder
If-Modified-Since
header.ifModifiedSince
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
ifModifiedSince
- the new value of the headerpublic RequestEntity.BodyBuilder ifModifiedSince(java.time.Instant ifModifiedSince)
RequestEntity.HeadersBuilder
If-Modified-Since
header.ifModifiedSince
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
ifModifiedSince
- the new value of the headerpublic RequestEntity.BodyBuilder ifModifiedSince(long ifModifiedSince)
RequestEntity.HeadersBuilder
If-Modified-Since
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
ifModifiedSince
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
ifModifiedSince
- the new value of the headerpublic RequestEntity.BodyBuilder ifNoneMatch(java.lang.String... ifNoneMatches)
RequestEntity.HeadersBuilder
If-None-Match
header.ifNoneMatch
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
ifNoneMatches
- the new value of the headerpublic RequestEntity<java.lang.Void> build()
RequestEntity.HeadersBuilder
build
in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>
RequestEntity.BodyBuilder.body(Object)
public <T> RequestEntity<T> body(T body)
RequestEntity.BodyBuilder
body
in interface RequestEntity.BodyBuilder
T
- the type of the bodybody
- the body of the request entitypublic <T> RequestEntity<T> body(T body, java.lang.reflect.Type type)
RequestEntity.BodyBuilder
body
in interface RequestEntity.BodyBuilder
T
- the type of the bodybody
- the body of the request entitytype
- the type of the body, useful for generic type resolution