Interface ServletHttpRequest<N,B>

Type Parameters:
N - The native request type
B - 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

    Nested Classes
    Modifier and Type
    Interface
    Description
    static 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 Type
    Method
    Description
    default void
    Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified ServletHttpRequest.AsyncExecutionCallback.
    default String
     
    Returns an InputStream that can be used to read the body of this HTTP request.
     
    Returns a BufferedReader 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

      default String getContextPath()
      Returns:
      The context path of the request.
    • getInputStream

      InputStream getInputStream() throws IOException
      Returns an 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 getReader() method is more appropriate.
      Returns:
      The input stream
      Throws:
      IOException - if a valid InputStream cannot be returned for some reason.
      IllegalStateException - if getReader() has already been called on this instance.
    • getReader

      BufferedReader getReader() throws IOException
      Returns a BufferedReader that can be used to read the text body of this HTTP request.
      Returns:
      The reader
      Throws:
      IOException - if a valid BufferedReader cannot be returned for some reason.
      IllegalStateException - if getInputStream() 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

      default void executeAsync(ServletHttpRequest.AsyncExecutionCallback asyncExecutionCallback)
      Causes the container to dispatch a thread, possibly from a managed thread pool, to run the specified ServletHttpRequest.AsyncExecutionCallback. After the execution is complete ServletHttpRequest.AsyncExecution.complete() should be called.
      Parameters:
      asyncExecutionCallback - The response publisher