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