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:
DefaultServletHttpRequest
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
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAsync execution.static interfaceAsync execution callback. -
Field Summary
Fields inherited from interface io.micronaut.http.HttpRequest
SCHEME_HTTP, SCHEME_HTTPS -
Method Summary
Modifier and TypeMethodDescriptiondefault voidexecuteAsync(ServletHttpRequest.AsyncExecutionCallback asyncExecutionCallback) Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specifiedServletHttpRequest.AsyncExecutionCallback.default StringReturns anInputStreamthat can be used to read the body of this HTTP request.Returns aBufferedReaderthat can be used to read the text body of this HTTP request.default booleanChecks if this request supports asynchronous operation.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.http.HttpRequest
accept, getCertificate, getCookies, getHttpVersion, getLocale, getMethod, getMethodName, getOrigin, getParameters, getPath, getRemoteAddress, getServerAddress, getServerName, getSslSession, getUri, getUserPrincipal, getUserPrincipal, isSecure, mutate, setAttributeMethods inherited from interface io.micronaut.core.attr.MutableAttributeHolder
removeAttribute
-
Method Details
-
getContextPath
- Returns:
- The context path of the request.
-
getInputStream
Returns anInputStreamthat 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 validInputStreamcannot be returned for some reason.IllegalStateException- ifgetReader()has already been called on this instance.
-
getReader
Returns aBufferedReaderthat can be used to read the text body of this HTTP request.- Returns:
- The reader
- Throws:
IOException- if a validBufferedReadercannot 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
-