Package io.micronaut.http
Class HttpRequestWrapper<B>
- java.lang.Object
-
- io.micronaut.http.HttpMessageWrapper<B>
-
- io.micronaut.http.HttpRequestWrapper<B>
-
- Type Parameters:
B- The Http body type
- All Implemented Interfaces:
io.micronaut.core.attr.AttributeHolder,io.micronaut.core.attr.MutableAttributeHolder,HttpMessage<B>,HttpRequest<B>
- Direct Known Subclasses:
FullHttpRequest
public class HttpRequestWrapper<B> extends HttpMessageWrapper<B> implements HttpRequest<B>
A wrapper around aHttpRequest.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS
-
-
Constructor Summary
Constructors Constructor Description HttpRequestWrapper(HttpRequest<B> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<MediaType>accept()A list of acceptedMediaTypeinstances sorted by their quality rating.java.util.Optional<java.security.cert.Certificate>getCertificate()Retrieves the Certificate used for mutual authentication.CookiesgetCookies()HttpRequest<B>getDelegate()HttpVersiongetHttpVersion()java.util.Optional<java.util.Locale>getLocale()HttpMethodgetMethod()java.lang.StringgetMethodName()HttpParametersgetParameters()java.lang.StringgetPath()java.net.InetSocketAddressgetRemoteAddress()java.net.InetSocketAddressgetServerAddress()java.lang.StringgetServerName()java.net.URIgetUri()java.util.Optional<java.security.Principal>getUserPrincipal()The user principal stored within the request.<T extends java.security.Principal>
java.util.Optional<T>getUserPrincipal(java.lang.Class<T> principalType)The user principal stored within the request.booleanisSecure()HttpRequest<B>setAttribute(java.lang.CharSequence name, java.lang.Object value)-
Methods inherited from class io.micronaut.http.HttpMessageWrapper
getAttributes, getBody, getBody, getBody, getHeaders
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getCharacterEncoding, getContentLength, getContentType, getHeaders
-
Methods inherited from interface io.micronaut.http.HttpRequest
mutate
-
-
-
-
Constructor Detail
-
HttpRequestWrapper
public HttpRequestWrapper(HttpRequest<B> delegate)
- Parameters:
delegate- The Http Request
-
-
Method Detail
-
getDelegate
public HttpRequest<B> getDelegate()
- Overrides:
getDelegatein classHttpMessageWrapper<B>- Returns:
- The Http message
-
getHttpVersion
public HttpVersion getHttpVersion()
- Specified by:
getHttpVersionin interfaceHttpRequest<B>- Returns:
- The http version of the request.
-
accept
public java.util.Collection<MediaType> accept()
Description copied from interface:HttpRequestA list of acceptedMediaTypeinstances sorted by their quality rating.- Specified by:
acceptin interfaceHttpRequest<B>- Returns:
- A list of zero or many
MediaTypeinstances
-
getUserPrincipal
@NonNull public java.util.Optional<java.security.Principal> getUserPrincipal()
Description copied from interface:HttpRequestThe user principal stored within the request.- Specified by:
getUserPrincipalin interfaceHttpRequest<B>- Returns:
- The principal
-
getUserPrincipal
@NonNull public <T extends java.security.Principal> java.util.Optional<T> getUserPrincipal(java.lang.Class<T> principalType)
Description copied from interface:HttpRequestThe user principal stored within the request.- Specified by:
getUserPrincipalin interfaceHttpRequest<B>- Type Parameters:
T- The principal type- Parameters:
principalType- The principal type- Returns:
- The principal
-
setAttribute
public HttpRequest<B> setAttribute(java.lang.CharSequence name, java.lang.Object value)
- Specified by:
setAttributein interfaceHttpMessage<B>- Specified by:
setAttributein interfaceHttpRequest<B>- Specified by:
setAttributein interfaceio.micronaut.core.attr.MutableAttributeHolder
-
getLocale
public java.util.Optional<java.util.Locale> getLocale()
- Specified by:
getLocalein interfaceHttpMessage<B>- Specified by:
getLocalein interfaceHttpRequest<B>- Returns:
- The locale of the message
-
getCertificate
public java.util.Optional<java.security.cert.Certificate> getCertificate()
Description copied from interface:HttpRequestRetrieves the Certificate used for mutual authentication.- Specified by:
getCertificatein interfaceHttpRequest<B>- Returns:
- A certificate used for authentication, if applicable.
-
getCookies
public Cookies getCookies()
- Specified by:
getCookiesin interfaceHttpRequest<B>- Returns:
- The
Cookiesinstance
-
getParameters
public HttpParameters getParameters()
- Specified by:
getParametersin interfaceHttpRequest<B>- Returns:
- The HTTP parameters contained with the URI query string
-
getMethod
public HttpMethod getMethod()
- Specified by:
getMethodin interfaceHttpRequest<B>- Returns:
- The request method
-
getMethodName
public java.lang.String getMethodName()
- Specified by:
getMethodNamein interfaceHttpRequest<B>- Returns:
- The name of the method (same as
HttpMethodvalue for standard http methods).
-
getUri
public java.net.URI getUri()
- Specified by:
getUriin interfaceHttpRequest<B>- Returns:
- The full request URI
-
getPath
public java.lang.String getPath()
- Specified by:
getPathin interfaceHttpRequest<B>- Returns:
- Get the raw, percent-encoded path without any parameters
-
getRemoteAddress
public java.net.InetSocketAddress getRemoteAddress()
- Specified by:
getRemoteAddressin interfaceHttpRequest<B>- Returns:
- Obtain the remote address
-
getServerAddress
public java.net.InetSocketAddress getServerAddress()
- Specified by:
getServerAddressin interfaceHttpRequest<B>- Returns:
- Obtain the server address
-
getServerName
public java.lang.String getServerName()
- Specified by:
getServerNamein interfaceHttpRequest<B>- Returns:
- The server host name
-
isSecure
public boolean isSecure()
- Specified by:
isSecurein interfaceHttpRequest<B>- Returns:
- Is the request an HTTPS request
-
-