Package io.micronaut.http
Interface HttpRequest<B>
- Type Parameters:
B- The Http message body
- All Superinterfaces:
io.micronaut.core.attr.AttributeHolder,HttpMessage<B>,io.micronaut.core.attr.MutableAttributeHolder
- All Known Subinterfaces:
FullHttpRequest<B>,MutableHttpRequest<B>,PushCapableHttpRequest<B>,ServerHttpRequest<B>
- All Known Implementing Classes:
HttpRequestWrapper,SimpleHttpRequest
Common interface for HTTP request implementations.
- Since:
- 1.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault Collection<MediaType>accept()A list of acceptedMediaTypeinstances sorted by their quality rating.static <T> MutableHttpRequest<T>create(HttpMethod httpMethod, String uri) Create a newMutableHttpRequestfor the given method and URI.static <T> MutableHttpRequest<T>create(HttpMethod httpMethod, String uri, String httpMethodName) Create a newMutableHttpRequestfor the given method and URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestfor aHttpMethod.GETrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestfor aHttpMethod.GETrequest for the given URI.default Optional<Certificate>Retrieves the Certificate used for mutual authentication.@NonNull Cookiesdefault HttpVersion@NonNull HttpMethoddefault @NonNull StringGet the origin header.@NonNull HttpParametersdefault @NonNull StringgetPath()default @NonNull InetSocketAddressdefault @NonNull InetSocketAddressdefault @Nullable Stringdefault Optional<SSLSession>Get the SSL session used for the connection to the client, if available.@NonNull URIgetUri()The user principal stored within the request.getUserPrincipal(Class<T> principalType) The user principal stored within the request.static MutableHttpRequest<?>Return aMutableHttpRequestfor aHttpMethod.HEADrequest for the given URI.static MutableHttpRequest<?>Return aMutableHttpRequestfor aHttpMethod.HEADrequest for the given URI.default booleanisSecure()default MutableHttpRequest<B>mutate()Returns a new request object that allows mutation.static <T> MutableHttpRequest<T>Return aMutableHttpRequestfor aHttpMethod.OPTIONSrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestfor aHttpMethod.OPTIONSrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.PATCHrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.PATCHrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.POSTrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.POSTrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.PUTrequest for the given URI.static <T> MutableHttpRequest<T>Return aMutableHttpRequestthat executes anHttpMethod.PUTrequest for the given URI.default HttpRequest<B>setAttribute(CharSequence name, Object value) Methods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttributeMethods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getHeadersMethods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
-
Field Details
-
SCHEME_HTTP
Constant for HTTP scheme.- See Also:
-
SCHEME_HTTPS
Constant for HTTPS scheme.- See Also:
-
-
Method Details
-
getCookies
- Returns:
- The
Cookiesinstance
-
getParameters
- Returns:
- The HTTP parameters contained with the URI query string
-
getMethod
- Returns:
- The request method
-
getUri
- Returns:
- The full request URI
-
mutate
Returns a new request object that allows mutation.- Returns:
- The mutable request
- Since:
- 2.0.0
-
getHttpVersion
- Returns:
- The http version of the request.
-
accept
A list of acceptedMediaTypeinstances sorted by their quality rating.- Returns:
- A list of zero or many
MediaTypeinstances
-
getMethodName
- Returns:
- The name of the method (same as
HttpMethodvalue for standard http methods).
-
getUserPrincipal
The user principal stored within the request.- Returns:
- The principal
- Since:
- 1.0.4
-
getUserPrincipal
@NonNull default <T extends Principal> @NonNull Optional<T> getUserPrincipal(Class<T> principalType) The user principal stored within the request.- Type Parameters:
T- The principal type- Parameters:
principalType- The principal type- Returns:
- The principal
- Since:
- 1.0.4
-
getPath
- Returns:
- Get the raw, percent-encoded path without any parameters
-
getRemoteAddress
- Returns:
- Obtain the remote address
-
getServerAddress
- Returns:
- Obtain the server address
-
getServerName
- Returns:
- The server host name
-
isSecure
default boolean isSecure()- Returns:
- Is the request an HTTPS request
-
setAttribute
- Specified by:
setAttributein interfaceHttpMessage<B>- Specified by:
setAttributein interfaceio.micronaut.core.attr.MutableAttributeHolder
-
getLocale
- Specified by:
getLocalein interfaceHttpMessage<B>- Returns:
- The locale of the message
-
getCertificate
Retrieves the Certificate used for mutual authentication.- Returns:
- A certificate used for authentication, if applicable.
-
getSslSession
Get the SSL session used for the connection to the client, if available.- Returns:
- The session
-
getOrigin
Get the origin header.- Returns:
- The origin header
- See Also:
-
GET
Return aMutableHttpRequestfor aHttpMethod.GETrequest for the given URI.- Type Parameters:
T- The Http request type- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
GET
Return aMutableHttpRequestfor aHttpMethod.GETrequest for the given URI.- Type Parameters:
T- The Http request type- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
OPTIONS
Return aMutableHttpRequestfor aHttpMethod.OPTIONSrequest for the given URI.- Type Parameters:
T- The Http request type- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
OPTIONS
Return aMutableHttpRequestfor aHttpMethod.OPTIONSrequest for the given URI.- Type Parameters:
T- The Http request type- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
HEAD
Return aMutableHttpRequestfor aHttpMethod.HEADrequest for the given URI.- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
HEAD
Return aMutableHttpRequestfor aHttpMethod.HEADrequest for the given URI.- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
POST
Return aMutableHttpRequestthat executes anHttpMethod.POSTrequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
POST
Return aMutableHttpRequestthat executes anHttpMethod.POSTrequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
PUT
Return aMutableHttpRequestthat executes anHttpMethod.PUTrequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
PUT
Return aMutableHttpRequestthat executes anHttpMethod.PUTrequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
PATCH
Return aMutableHttpRequestthat executes anHttpMethod.PATCHrequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
PATCH
Return aMutableHttpRequestthat executes anHttpMethod.PATCHrequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
DELETE
Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
DELETE
Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.- Type Parameters:
T- The body type- Parameters:
uri- The URIbody- The body of the request (content type defaults toMediaType.APPLICATION_JSON- Returns:
- The
MutableHttpRequestinstance - See Also:
-
DELETE
Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.- Type Parameters:
T- The Http request type- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
DELETE
Return aMutableHttpRequestthat executes anHttpMethod.DELETErequest for the given URI.- Type Parameters:
T- The Http request type- Parameters:
uri- The URI- Returns:
- The
MutableHttpRequestinstance - See Also:
-
create
Create a newMutableHttpRequestfor the given method and URI.- Type Parameters:
T- The Http request type- Parameters:
httpMethod- The methoduri- The URI- Returns:
- The request
-
create
Create a newMutableHttpRequestfor the given method and URI.- Type Parameters:
T- The Http request type- Parameters:
httpMethod- The methoduri- The URIhttpMethodName- Method name - for standard http methods is equal toEnum.name()- Returns:
- The request
-