Package io.micronaut.servlet.http
Interface ServletHttpRequest<N,B>
- Type Parameters:
N
- The native request typeB
- The body type
- All Superinterfaces:
io.micronaut.core.attr.AttributeHolder
,io.micronaut.http.HttpMessage<B>
,io.micronaut.http.HttpRequest<B>
,io.micronaut.core.attr.MutableAttributeHolder
- All Known Subinterfaces:
MutableServletHttpRequest<N,
B>
- All Known Implementing Classes:
ApacheServletHttpRequest
,DefaultServletHttpRequest
,PojaHttpRequest
public interface ServletHttpRequest<N,B>
extends io.micronaut.http.HttpRequest<B>
Interface that models a serverless request which typically support blocking I/O.
- Since:
- 2.0.0
- Author:
- graemerocher
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Async execution.static interface
Async execution callback. -
Field Summary
Fields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
executeAsync
(ServletHttpRequest.AsyncExecutionCallback asyncExecutionCallback) Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specifiedServletHttpRequest.AsyncExecutionCallback
.default String
Returns anInputStream
that can be used to read the body of this HTTP request.Returns aBufferedReader
that can be used to read the text body of this HTTP request.default boolean
Checks if this request supports asynchronous operation.Methods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttribute
Methods inherited from interface io.micronaut.http.HttpMessage
getAttributes, getBody, getBody, getBody, getBody, getBodyWriter, getCharacterEncoding, getContentLength, getContentType, getHeaders
Methods inherited from interface io.micronaut.http.HttpRequest
accept, getCertificate, getCookies, getHttpVersion, getLocale, getMethod, getMethodName, getOrigin, getParameters, getPath, getRemoteAddress, getServerAddress, getServerName, getSslSession, getUri, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttribute, toMutableRequest
Methods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
-
Method Details
-
getContextPath
- Returns:
- The context path of the request.
-
getInputStream
Returns anInputStream
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, thegetReader()
method is more appropriate.- Returns:
- The input stream
- Throws:
IOException
- if a validInputStream
cannot be returned for some reason.IllegalStateException
- ifgetReader()
has already been called on this instance.
-
getReader
Returns aBufferedReader
that can be used to read the text body of this HTTP request.- Returns:
- The reader
- Throws:
IOException
- if a validBufferedReader
cannot be returned for some reason.IllegalStateException
- ifgetInputStream()
has already been called on this instance.
-
getNativeRequest
N getNativeRequest()- Returns:
- The native request type
-
isAsyncSupported
default boolean isAsyncSupported()Checks if this request supports asynchronous operation.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.
- Returns:
- true if this request supports asynchronous operation, false otherwise
- Since:
- Servlet 3.0
-
executeAsync
Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specifiedServletHttpRequest.AsyncExecutionCallback
. After the execution is completeServletHttpRequest.AsyncExecution.complete()
should be called.- Parameters:
asyncExecutionCallback
- The response publisher
-