B
- The body type@Internal public class DefaultServletHttpRequest<B> extends java.lang.Object implements ServletHttpRequest<javax.servlet.http.HttpServletRequest,B>, io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>, ServletExchange<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>, StreamedServletMessage<B,byte[]>
HttpRequest
ontop of the Servlet API.Modifier | Constructor and Description |
---|---|
protected |
DefaultServletHttpRequest(javax.servlet.http.HttpServletRequest delegate,
javax.servlet.http.HttpServletResponse response,
io.micronaut.http.codec.MediaTypeCodecRegistry codecRegistry)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
clear() |
<T> java.util.Optional<T> |
get(java.lang.CharSequence key,
io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext) |
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
getAttributes() |
java.util.Optional<B> |
getBody() |
<T> java.util.Optional<T> |
getBody(io.micronaut.core.type.Argument<T> arg) |
java.nio.charset.Charset |
getCharacterEncoding() |
io.micronaut.http.codec.MediaTypeCodecRegistry |
getCodecRegistry() |
long |
getContentLength() |
java.util.Optional<io.micronaut.http.MediaType> |
getContentType() |
java.lang.String |
getContextPath() |
io.micronaut.http.cookie.Cookies |
getCookies() |
io.micronaut.http.HttpHeaders |
getHeaders() |
java.io.InputStream |
getInputStream()
Returns an
InputStream that can be used to read the body of this HTTP request. |
java.util.Optional<java.util.Locale> |
getLocale() |
io.micronaut.http.HttpMethod |
getMethod() |
java.lang.String |
getMethodName() |
javax.servlet.http.HttpServletRequest |
getNativeRequest() |
io.micronaut.http.HttpParameters |
getParameters() |
java.io.BufferedReader |
getReader()
Returns a
BufferedReader that can be used to read the text body of this HTTP request. |
java.net.InetSocketAddress |
getRemoteAddress() |
ServletHttpRequest<javax.servlet.http.HttpServletRequest,? super java.lang.Object> |
getRequest() |
ServletHttpResponse<javax.servlet.http.HttpServletResponse,? super java.lang.Object> |
getResponse() |
java.net.InetSocketAddress |
getServerAddress() |
java.lang.String |
getServerName() |
java.net.URI |
getUri() |
java.util.Optional<java.security.Principal> |
getUserPrincipal() |
boolean |
isAsyncSupported()
Checks if this request supports asynchronous operation.
|
boolean |
isSecure() |
java.util.Set<java.lang.String> |
names() |
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
put(java.lang.CharSequence key,
java.lang.Object value) |
io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> |
remove(java.lang.CharSequence key) |
void |
subscribe(org.reactivestreams.Subscriber<? super byte[]> s) |
org.reactivestreams.Publisher<? extends io.micronaut.http.MutableHttpResponse<?>> |
subscribeOnExecutor(org.reactivestreams.Publisher<? extends io.micronaut.http.MutableHttpResponse<?>> responsePublisher)
Causes the container to dispatch a thread, possibly from a managed
thread pool, to run the specified
Runnable . |
java.util.Collection<java.lang.Object> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, create, create, DELETE, DELETE, DELETE, GET, GET, getCertificate, getHttpVersion, getPath, getUserPrincipal, HEAD, HEAD, mutate, OPTIONS, OPTIONS, PATCH, PATCH, POST, POST, PUT, PUT, setAttribute
of, putAll, putAll
protected DefaultServletHttpRequest(javax.servlet.http.HttpServletRequest delegate, javax.servlet.http.HttpServletResponse response, io.micronaut.http.codec.MediaTypeCodecRegistry codecRegistry)
delegate
- The servlet requestresponse
- The servlet responsecodecRegistry
- The codec registrypublic io.micronaut.http.codec.MediaTypeCodecRegistry getCodecRegistry()
public boolean isAsyncSupported()
ServletHttpRequest
Asynchronous operation is disabled for this request if this request is within the scope of a filter or servlet that has not been annotated or flagged in the deployment descriptor as being able to support asynchronous handling.
isAsyncSupported
in interface ServletHttpRequest<javax.servlet.http.HttpServletRequest,B>
public org.reactivestreams.Publisher<? extends io.micronaut.http.MutableHttpResponse<?>> subscribeOnExecutor(org.reactivestreams.Publisher<? extends io.micronaut.http.MutableHttpResponse<?>> responsePublisher)
ServletHttpRequest
Runnable
. The container may
propagate appropriate contextual information to the Runnable
.subscribeOnExecutor
in interface ServletHttpRequest<javax.servlet.http.HttpServletRequest,B>
responsePublisher
- The response publisher@NonNull public <T> java.util.Optional<T> getBody(@NonNull io.micronaut.core.type.Argument<T> arg)
getBody
in interface io.micronaut.http.HttpMessage<B>
@NonNull public java.util.Optional<java.security.Principal> getUserPrincipal()
getUserPrincipal
in interface io.micronaut.http.HttpRequest<B>
public boolean isSecure()
isSecure
in interface io.micronaut.http.HttpRequest<B>
@NonNull public java.util.Optional<io.micronaut.http.MediaType> getContentType()
getContentType
in interface io.micronaut.http.HttpMessage<B>
public long getContentLength()
getContentLength
in interface io.micronaut.http.HttpMessage<B>
@NonNull public java.net.InetSocketAddress getRemoteAddress()
getRemoteAddress
in interface io.micronaut.http.HttpRequest<B>
@NonNull public java.net.InetSocketAddress getServerAddress()
getServerAddress
in interface io.micronaut.http.HttpRequest<B>
@Nullable public java.lang.String getServerName()
getServerName
in interface io.micronaut.http.HttpRequest<B>
@NonNull public java.util.Optional<java.util.Locale> getLocale()
@NonNull public java.nio.charset.Charset getCharacterEncoding()
getCharacterEncoding
in interface io.micronaut.http.HttpMessage<B>
public java.lang.String getContextPath()
getContextPath
in interface ServletHttpRequest<javax.servlet.http.HttpServletRequest,B>
public java.io.InputStream getInputStream() throws java.io.IOException
ServletHttpRequest
InputStream
that can be used to read the body of this HTTP request.
This method is typically used to read binary data. If the body is text, the
ServletHttpRequest.getReader()
method is more appropriate.getInputStream
in interface ServletHttpRequest<javax.servlet.http.HttpServletRequest,B>
java.io.IOException
- if a valid InputStream
cannot be returned for some reason.public java.io.BufferedReader getReader() throws java.io.IOException
ServletHttpRequest
BufferedReader
that can be used to read the text body of this HTTP request.getReader
in interface ServletHttpRequest<javax.servlet.http.HttpServletRequest,B>
java.io.IOException
- if a valid BufferedReader
cannot be returned for some reason.public javax.servlet.http.HttpServletRequest getNativeRequest()
getNativeRequest
in interface ServletHttpRequest<javax.servlet.http.HttpServletRequest,B>
@NonNull public io.micronaut.http.cookie.Cookies getCookies()
getCookies
in interface io.micronaut.http.HttpRequest<B>
@NonNull public io.micronaut.http.HttpParameters getParameters()
getParameters
in interface io.micronaut.http.HttpRequest<B>
@NonNull public io.micronaut.http.HttpMethod getMethod()
getMethod
in interface io.micronaut.http.HttpRequest<B>
@NonNull public java.lang.String getMethodName()
getMethodName
in interface io.micronaut.http.HttpRequest<B>
@NonNull public java.net.URI getUri()
getUri
in interface io.micronaut.http.HttpRequest<B>
@NonNull public io.micronaut.http.HttpHeaders getHeaders()
getHeaders
in interface io.micronaut.http.HttpMessage<B>
@NonNull public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> getAttributes()
getAttributes
in interface io.micronaut.core.attr.AttributeHolder
getAttributes
in interface io.micronaut.core.attr.MutableAttributeHolder
getAttributes
in interface io.micronaut.http.HttpMessage<B>
@NonNull public java.util.Optional<B> getBody()
getBody
in interface io.micronaut.http.HttpMessage<B>
public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> put(java.lang.CharSequence key, @Nullable java.lang.Object value)
put
in interface io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>
public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> remove(java.lang.CharSequence key)
remove
in interface io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>
public io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object> clear()
clear
in interface io.micronaut.core.convert.value.MutableConvertibleValues<java.lang.Object>
public java.util.Set<java.lang.String> names()
names
in interface io.micronaut.core.convert.value.ConvertibleValues<java.lang.Object>
public java.util.Collection<java.lang.Object> values()
values
in interface io.micronaut.core.convert.value.ConvertibleValues<java.lang.Object>
public <T> java.util.Optional<T> get(java.lang.CharSequence key, io.micronaut.core.convert.ArgumentConversionContext<T> conversionContext)
get
in interface io.micronaut.core.value.ValueResolver<java.lang.CharSequence>
public ServletHttpRequest<javax.servlet.http.HttpServletRequest,? super java.lang.Object> getRequest()
getRequest
in interface ServletExchange<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
public ServletHttpResponse<javax.servlet.http.HttpServletResponse,? super java.lang.Object> getResponse()
getResponse
in interface ServletExchange<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
public void subscribe(org.reactivestreams.Subscriber<? super byte[]> s)
subscribe
in interface org.reactivestreams.Publisher<byte[]>