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.
|
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(long 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.HeadersBuilderheader 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.HeadersBuilderAccept header.accept in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>acceptableMediaTypes - the acceptable media typespublic RequestEntity.BodyBuilder acceptCharset(java.nio.charset.Charset... acceptableCharsets)
RequestEntity.HeadersBuilderAccept-Charset header.acceptCharset in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>acceptableCharsets - the acceptable charsetspublic RequestEntity.BodyBuilder contentLength(long contentLength)
RequestEntity.BodyBuilderContent-Length header.contentLength in interface RequestEntity.BodyBuildercontentLength - the content lengthHttpHeaders.setContentLength(long)public RequestEntity.BodyBuilder contentType(MediaType contentType)
RequestEntity.BodyBuilderContent-Type header.contentType in interface RequestEntity.BodyBuildercontentType - the content typeHttpHeaders.setContentType(MediaType)public RequestEntity.BodyBuilder ifModifiedSince(long ifModifiedSince)
RequestEntity.HeadersBuilderIf-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.HeadersBuilderIf-None-Match header.ifNoneMatch in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>ifNoneMatches - the new value of the headerpublic RequestEntity<java.lang.Void> build()
RequestEntity.HeadersBuilderbuild in interface RequestEntity.HeadersBuilder<RequestEntity.BodyBuilder>RequestEntity.BodyBuilder.body(Object)public <T> RequestEntity<T> body(T body)
RequestEntity.BodyBuilderbody in interface RequestEntity.BodyBuilderT - the type of the bodybody - the body of the request entity