B
- The Http message bodypublic interface HttpRequest<B> extends HttpMessage<B>
Common interface for HTTP request implementations.
Modifier and Type | Field and Description |
---|---|
static String |
SCHEME_HTTP
Constant for HTTP scheme.
|
static String |
SCHEME_HTTPS
Constant for HTTPS scheme.
|
Modifier and Type | Method and Description |
---|---|
default Collection<MediaType> |
accept()
A list of accepted
MediaType instances sorted by their quality rating. |
static <T> MutableHttpRequest<T> |
create(HttpMethod httpMethod,
String uri)
Create a new
MutableHttpRequest for the given method and URI. |
static <T> MutableHttpRequest<T> |
create(HttpMethod httpMethod,
String uri,
String httpMethodName)
Create a new
MutableHttpRequest for the given method and URI. |
static <T> MutableHttpRequest<T> |
DELETE(String uri)
Return a
MutableHttpRequest that executes an HttpMethod.DELETE request for the given URI. |
static <T> MutableHttpRequest<T> |
DELETE(String uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.DELETE request for the given URI. |
static <T> MutableHttpRequest<T> |
DELETE(URI uri)
Return a
MutableHttpRequest that executes an HttpMethod.DELETE request for the given URI. |
static <T> MutableHttpRequest<T> |
DELETE(URI uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.DELETE request for the given URI. |
static <T> MutableHttpRequest<T> |
GET(String uri)
Return a
MutableHttpRequest for a HttpMethod.GET request for the given URI. |
static <T> MutableHttpRequest<T> |
GET(URI uri)
Return a
MutableHttpRequest for a HttpMethod.GET request for the given URI. |
default Optional<Certificate> |
getCertificate()
Retrieves the Certificate used for mutual authentication.
|
Cookies |
getCookies() |
default HttpVersion |
getHttpVersion() |
default Optional<Locale> |
getLocale() |
HttpMethod |
getMethod() |
default String |
getMethodName() |
HttpParameters |
getParameters() |
default String |
getPath() |
default InetSocketAddress |
getRemoteAddress() |
default InetSocketAddress |
getServerAddress() |
default String |
getServerName() |
URI |
getUri() |
default Optional<Principal> |
getUserPrincipal()
The user principal stored within the request.
|
default <T extends Principal> |
getUserPrincipal(Class<T> principalType)
The user principal stored within the request.
|
static MutableHttpRequest<?> |
HEAD(String uri)
Return a
MutableHttpRequest for a HttpMethod.HEAD request for the given URI. |
static MutableHttpRequest<?> |
HEAD(URI uri)
Return a
MutableHttpRequest for a HttpMethod.HEAD request for the given URI. |
default boolean |
isSecure() |
default MutableHttpRequest<B> |
mutate()
Returns a new request object that allows mutation.
|
static <T> MutableHttpRequest<T> |
OPTIONS(String uri)
Return a
MutableHttpRequest for a HttpMethod.OPTIONS request for the given URI. |
static <T> MutableHttpRequest<T> |
OPTIONS(URI uri)
Return a
MutableHttpRequest for a HttpMethod.OPTIONS request for the given URI. |
static <T> MutableHttpRequest<T> |
PATCH(String uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.PATCH request for the given URI. |
static <T> MutableHttpRequest<T> |
PATCH(URI uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.PATCH request for the given URI. |
static <T> MutableHttpRequest<T> |
POST(String uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.POST request for the given URI. |
static <T> MutableHttpRequest<T> |
POST(URI uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.POST request for the given URI. |
static <T> MutableHttpRequest<T> |
PUT(String uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.PUT request for the given URI. |
static <T> MutableHttpRequest<T> |
PUT(URI uri,
T body)
Return a
MutableHttpRequest that executes an HttpMethod.PUT request for the given URI. |
default HttpRequest<B> |
setAttribute(CharSequence name,
Object value)
Sets an attribute on the message.
|
getAttributes, getBody, getBody, getBody, getCharacterEncoding, getContentLength, getContentType, getHeaders
removeAttribute
getAttribute, getAttribute
static final String SCHEME_HTTP
static final String SCHEME_HTTPS
@NonNull HttpParameters getParameters()
@NonNull HttpMethod getMethod()
default MutableHttpRequest<B> mutate()
default HttpVersion getHttpVersion()
default Collection<MediaType> accept()
MediaType
instances sorted by their quality rating.MediaType
instances@NonNull default String getMethodName()
HttpMethod
value for standard http methods).@NonNull default Optional<Principal> getUserPrincipal()
@NonNull default <T extends Principal> Optional<T> getUserPrincipal(Class<T> principalType)
T
- The principal typeprincipalType
- The principal type@NonNull default String getPath()
@NonNull default InetSocketAddress getRemoteAddress()
@NonNull default InetSocketAddress getServerAddress()
default boolean isSecure()
default HttpRequest<B> setAttribute(CharSequence name, Object value)
MutableAttributeHolder
setAttribute
in interface HttpMessage<B>
setAttribute
in interface MutableAttributeHolder
name
- The name of the attributevalue
- The value of the attributedefault Optional<Locale> getLocale()
getLocale
in interface HttpMessage<B>
default Optional<Certificate> getCertificate()
static <T> MutableHttpRequest<T> GET(URI uri)
MutableHttpRequest
for a HttpMethod.GET
request for the given URI.T
- The Http request typeuri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> GET(String uri)
MutableHttpRequest
for a HttpMethod.GET
request for the given URI.T
- The Http request typeuri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> OPTIONS(URI uri)
MutableHttpRequest
for a HttpMethod.OPTIONS
request for the given URI.T
- The Http request typeuri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> OPTIONS(String uri)
MutableHttpRequest
for a HttpMethod.OPTIONS
request for the given URI.T
- The Http request typeuri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static MutableHttpRequest<?> HEAD(URI uri)
MutableHttpRequest
for a HttpMethod.HEAD
request for the given URI.uri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static MutableHttpRequest<?> HEAD(String uri)
MutableHttpRequest
for a HttpMethod.HEAD
request for the given URI.uri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> POST(URI uri, T body)
MutableHttpRequest
that executes an HttpMethod.POST
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> POST(String uri, T body)
MutableHttpRequest
that executes an HttpMethod.POST
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> PUT(URI uri, T body)
MutableHttpRequest
that executes an HttpMethod.PUT
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> PUT(String uri, T body)
MutableHttpRequest
that executes an HttpMethod.PUT
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> PATCH(URI uri, T body)
MutableHttpRequest
that executes an HttpMethod.PATCH
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> PATCH(String uri, T body)
MutableHttpRequest
that executes an HttpMethod.PATCH
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> DELETE(URI uri, T body)
MutableHttpRequest
that executes an HttpMethod.DELETE
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> DELETE(String uri, T body)
MutableHttpRequest
that executes an HttpMethod.DELETE
request for the given URI.T
- The body typeuri
- The URIbody
- The body of the request (content type defaults to MediaType.APPLICATION_JSON
MutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> DELETE(String uri)
MutableHttpRequest
that executes an HttpMethod.DELETE
request for the given URI.T
- The Http request typeuri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> DELETE(URI uri)
MutableHttpRequest
that executes an HttpMethod.DELETE
request for the given URI.T
- The Http request typeuri
- The URIMutableHttpRequest
instanceHttpRequestFactory
static <T> MutableHttpRequest<T> create(HttpMethod httpMethod, String uri)
MutableHttpRequest
for the given method and URI.T
- The Http request typehttpMethod
- The methoduri
- The URIstatic <T> MutableHttpRequest<T> create(HttpMethod httpMethod, String uri, String httpMethodName)
MutableHttpRequest
for the given method and URI.T
- The Http request typehttpMethod
- The methoduri
- The URIhttpMethodName
- Method name - for standard http methods is equal to Enum.name()