B
- The request body typepublic interface MutableHttpRequest<B> extends HttpRequest<B>, MutableHttpMessage<B>
HttpRequest
that allows mutating headers, the body etc.SCHEME_HTTP, SCHEME_HTTPS
Modifier and Type | Method and Description |
---|---|
default MutableHttpRequest<B> |
accept(java.lang.CharSequence... mediaTypes)
Sets the acceptable
MediaType instances via the HttpHeaders.ACCEPT header. |
default MutableHttpRequest<B> |
accept(MediaType... mediaTypes)
Sets the acceptable
MediaType instances via the HttpHeaders.ACCEPT header. |
default MutableHttpRequest<B> |
basicAuth(java.lang.CharSequence username,
java.lang.CharSequence password)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Basic Base64(username:password)". |
default MutableHttpRequest<B> |
bearerAuth(java.lang.CharSequence token)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Bearer token". |
<T> MutableHttpRequest<T> |
body(T body)
Sets the body.
|
default MutableHttpRequest<B> |
contentEncoding(java.lang.CharSequence encoding)
Sets the content encoding.
|
default MutableHttpRequest<B> |
contentLength(long length)
Sets the content length.
|
default MutableHttpRequest<B> |
contentType(java.lang.CharSequence contentType)
Set the response content type.
|
default MutableHttpRequest<B> |
contentType(MediaType mediaType)
Set the response content type.
|
MutableHttpRequest<B> |
cookie(Cookie cookie)
Sets the specified cookie on the request.
|
default MutableHttpRequest<B> |
cookies(java.util.Set<Cookie> cookies)
Sets the specified cookies on the request.
|
MutableHttpHeaders |
getHeaders() |
MutableHttpParameters |
getParameters() |
default MutableHttpRequest<B> |
header(java.lang.CharSequence name,
java.lang.CharSequence value)
Set a response header.
|
default MutableHttpRequest<B> |
headers(java.util.function.Consumer<MutableHttpHeaders> headers)
Mutate the headers with the given consumer.
|
default MutableHttpRequest<B> |
headers(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> namesAndValues)
Set multiple headers.
|
default MutableHttpRequest<B> |
uri(java.util.function.Consumer<UriBuilder> consumer)
Alters the URI of the request with the given URI builder.
|
MutableHttpRequest<B> |
uri(java.net.URI uri)
Sets the uri on the request.
|
accept, create, create, DELETE, DELETE, DELETE, GET, GET, getCertificate, getCookies, getHttpVersion, getLocale, getMethod, getMethodName, getPath, getRemoteAddress, getServerAddress, getServerName, getUri, getUserPrincipal, getUserPrincipal, HEAD, HEAD, isSecure, mutate, OPTIONS, OPTIONS, PATCH, PATCH, POST, POST, PUT, PUT, setAttribute
getAttributes, getBody, getBody, getBody, getCharacterEncoding, getContentLength, getContentType
removeAttribute
getAttribute, getAttribute
MutableHttpRequest<B> cookie(Cookie cookie)
cookie
- the Cookie to return to the clientdefault MutableHttpRequest<B> cookies(java.util.Set<Cookie> cookies)
cookies
- the Cookies to return to the clientMutableHttpRequest<B> uri(java.net.URI uri)
uri
- The uri to call<T> MutableHttpRequest<T> body(T body)
MutableHttpMessage
body
in interface MutableHttpMessage<B>
T
- The new body typebody
- The bodyMutableHttpHeaders getHeaders()
getHeaders
in interface HttpMessage<B>
getHeaders
in interface MutableHttpMessage<B>
HttpHeaders
objectMutableHttpParameters getParameters()
getParameters
in interface HttpRequest<B>
@NonNull default MutableHttpRequest<B> uri(@NonNull java.util.function.Consumer<UriBuilder> consumer)
consumer
- A consumer that accepts the URIdefault MutableHttpRequest<B> accept(MediaType... mediaTypes)
MediaType
instances via the HttpHeaders.ACCEPT
header.mediaTypes
- The media typesdefault MutableHttpRequest<B> accept(java.lang.CharSequence... mediaTypes)
MediaType
instances via the HttpHeaders.ACCEPT
header.mediaTypes
- The media typesdefault MutableHttpRequest<B> headers(java.util.function.Consumer<MutableHttpHeaders> headers)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
headers
- The headersdefault MutableHttpRequest<B> header(java.lang.CharSequence name, java.lang.CharSequence value)
MutableHttpMessage
header
in interface MutableHttpMessage<B>
name
- The name of the headervalue
- The value of the headerdefault MutableHttpRequest<B> basicAuth(java.lang.CharSequence username, java.lang.CharSequence password)
MutableHttpMessage
HttpHeaders.AUTHORIZATION
header, with value: "Basic Base64(username:password)".basicAuth
in interface MutableHttpMessage<B>
username
- The username part of the credentialspassword
- The password part of the credentialsdefault MutableHttpRequest<B> bearerAuth(java.lang.CharSequence token)
MutableHttpMessage
HttpHeaders.AUTHORIZATION
header, with value: "Bearer token".bearerAuth
in interface MutableHttpMessage<B>
token
- The tokendefault MutableHttpRequest<B> headers(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> namesAndValues)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
namesAndValues
- The names and valuesdefault MutableHttpRequest<B> contentLength(long length)
MutableHttpMessage
contentLength
in interface MutableHttpMessage<B>
length
- The lengthdefault MutableHttpRequest<B> contentType(java.lang.CharSequence contentType)
MutableHttpMessage
contentType
in interface MutableHttpMessage<B>
contentType
- The content typedefault MutableHttpRequest<B> contentType(MediaType mediaType)
MutableHttpMessage
contentType
in interface MutableHttpMessage<B>
mediaType
- The media typedefault MutableHttpRequest<B> contentEncoding(java.lang.CharSequence encoding)
MutableHttpMessage
contentEncoding
in interface MutableHttpMessage<B>
encoding
- The encoding to use