Interface StreamingResponseBody

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface StreamingResponseBody
A controller method return value type for asynchronous request processing where the application can write directly to the response OutputStream without holding up the Servlet container thread.

Note: when using this option it is highly recommended to configure explicitly the TaskExecutor used in Spring MVC for executing asynchronous requests. Both the MVC Java config and the MVC namespaces provide options to configure asynchronous handling. If not using those, an application can set the taskExecutor property of RequestMappingHandlerAdapter.

Since:
4.2
Author:
Rossen Stoyanchev
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    writeTo(OutputStream outputStream)
    A callback for writing to the response body.
  • Method Details

    • writeTo

      void writeTo(OutputStream outputStream) throws IOException
      A callback for writing to the response body.
      Parameters:
      outputStream - the stream for the response body
      Throws:
      IOException - an exception while writing