Package io.micronaut.http.simple
Class SimpleHttpRequest<B>
- java.lang.Object
-
- io.micronaut.http.simple.SimpleHttpRequest<B>
-
- Type Parameters:
B
- the type of the body
- All Implemented Interfaces:
io.micronaut.core.attr.AttributeHolder
,io.micronaut.core.attr.MutableAttributeHolder
,HttpMessage<B>
,HttpRequest<B>
,MutableHttpMessage<B>
,MutableHttpRequest<B>
public class SimpleHttpRequest<B> extends java.lang.Object implements MutableHttpRequest<B>
SimpleMutableHttpRequest
implementation.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS
-
-
Constructor Summary
Constructors Constructor Description SimpleHttpRequest(HttpMethod method, java.lang.String uri, B body)
SimpleMutableHttpRequest
implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> MutableHttpRequest<T>
body(T body)
Sets the body.MutableHttpRequest<B>
cookie(Cookie cookie)
Sets the specified cookie on the request.MutableHttpRequest<B>
cookies(java.util.Set<Cookie> cookies)
Sets the specified cookies on the request.io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>
getAttributes()
AMutableConvertibleValues
of the attributes for this HTTP message.java.util.Optional<B>
getBody()
Cookies
getCookies()
MutableHttpHeaders
getHeaders()
HttpMethod
getMethod()
MutableHttpParameters
getParameters()
java.net.URI
getUri()
MutableHttpRequest<B>
uri(java.net.URI uri)
Sets the uri on the request.-
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
getBody, getBody, getCharacterEncoding, getContentLength, getContentType
-
Methods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getHttpVersion, getLocale, getMethodName, getPath, getRemoteAddress, getServerAddress, getServerName, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute
-
Methods inherited from interface io.micronaut.http.MutableHttpRequest
accept, accept, basicAuth, bearerAuth, contentEncoding, contentLength, contentType, contentType, header, headers, headers, uri
-
-
-
-
Constructor Detail
-
SimpleHttpRequest
public SimpleHttpRequest(HttpMethod method, java.lang.String uri, B body)
SimpleMutableHttpRequest
implementation.- Parameters:
method
- the HTTP methoduri
- the URI of the requestbody
- the optional body of the request
-
-
Method Detail
-
cookie
public MutableHttpRequest<B> cookie(Cookie cookie)
Description copied from interface:MutableHttpRequest
Sets the specified cookie on the request.- Specified by:
cookie
in interfaceMutableHttpRequest<B>
- Parameters:
cookie
- the Cookie to return to the client- Returns:
- The http request
-
cookies
public MutableHttpRequest<B> cookies(java.util.Set<Cookie> cookies)
Description copied from interface:MutableHttpRequest
Sets the specified cookies on the request.- Specified by:
cookies
in interfaceMutableHttpRequest<B>
- Parameters:
cookies
- the Cookies to return to the client- Returns:
- The http request
-
uri
public MutableHttpRequest<B> uri(java.net.URI uri)
Description copied from interface:MutableHttpRequest
Sets the uri on the request.- Specified by:
uri
in interfaceMutableHttpRequest<B>
- Parameters:
uri
- The uri to call- Returns:
- The http request
-
body
public <T> MutableHttpRequest<T> body(T body)
Description copied from interface:MutableHttpMessage
Sets the body.- Specified by:
body
in interfaceMutableHttpMessage<B>
- Specified by:
body
in interfaceMutableHttpRequest<B>
- Type Parameters:
T
- The new body type- Parameters:
body
- The body- Returns:
- This message
-
getHeaders
public MutableHttpHeaders getHeaders()
- Specified by:
getHeaders
in interfaceHttpMessage<B>
- Specified by:
getHeaders
in interfaceMutableHttpMessage<B>
- Specified by:
getHeaders
in interfaceMutableHttpRequest<B>
- Returns:
- The
HttpHeaders
object
-
getCookies
public Cookies getCookies()
- Specified by:
getCookies
in interfaceHttpRequest<B>
- Returns:
- The
Cookies
instance
-
getParameters
public MutableHttpParameters getParameters()
- Specified by:
getParameters
in interfaceHttpRequest<B>
- Specified by:
getParameters
in interfaceMutableHttpRequest<B>
- Returns:
- The HTTP parameters contained with the URI query string
-
getMethod
public HttpMethod getMethod()
- Specified by:
getMethod
in interfaceHttpRequest<B>
- Returns:
- The request method
-
getUri
public java.net.URI getUri()
- Specified by:
getUri
in interfaceHttpRequest<B>
- Returns:
- The full request URI
-
getAttributes
public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> getAttributes()
Description copied from interface:HttpMessage
A
MutableConvertibleValues
of the attributes for this HTTP message.Attributes are designed for internal data sharing and hence are isolated from headers and parameters which are client supplied
- Specified by:
getAttributes
in interfaceio.micronaut.core.attr.AttributeHolder
- Specified by:
getAttributes
in interfaceHttpMessage<B>
- Specified by:
getAttributes
in interfaceio.micronaut.core.attr.MutableAttributeHolder
- Returns:
- The attributes of the message
-
getBody
public java.util.Optional<B> getBody()
- Specified by:
getBody
in interfaceHttpMessage<B>
- Returns:
- The request body
-
-