Top Description Inners Constructors Methods
org.springframework.web.servlet.mvc.method.annotation

public Class StreamingResponseBodyReturnValueHandler

extends Object
implements HandlerMethodReturnValueHandler
Class Inheritance
All Implemented Interfaces
org.springframework.web.method.support.HandlerMethodReturnValueHandler
Imports
java.io.OutputStream, java.util.concurrent.Callable, jakarta.servlet.ServletRequest, jakarta.servlet.http.HttpServletResponse, org.springframework.core.MethodParameter, .ResolvableType, org.springframework.http.ResponseEntity, org.springframework.http.server.ServerHttpResponse, .ServletServerHttpResponse, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.context.request.NativeWebRequest, org.springframework.web.context.request.async.WebAsyncUtils, org.springframework.web.filter.ShallowEtagHeaderFilter, org.springframework.web.method.support.HandlerMethodReturnValueHandler, .ModelAndViewContainer

Supports return values of type org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody and also ResponseEntity<StreamingResponseBody>.
Author
Rossen Stoyanchev
Since
4.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
handleReturnValue(Object
the value returned from the handler method
returnValue
,
MethodParameter
the type of the return value. This type must have previously been passed to supportsReturnType which must have returned true.
returnType
,
ModelAndViewContainer
the ModelAndViewContainer for the current request
mavContainer
,
NativeWebRequest
the current request
webRequest
)

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.handleReturnValue.

Handle the given return value by adding attributes to the model and setting a view or setting the ModelAndViewContainer#setRequestHandled flag to true to indicate the response has been handled directly.

public boolean
supportsReturnType(MethodParameter
the method return type to check
returnType
)

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.supportsReturnType.

Whether the given method return type is supported by this handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StreamingResponseBodyReturnValueHandlerback to summary
public StreamingResponseBodyReturnValueHandler()

Method Detail

handleReturnValueback to summary
public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.handleReturnValue.

Doc from org.springframework.web.method.support.HandlerMethodReturnValueHandler.handleReturnValue.

Handle the given return value by adding attributes to the model and setting a view or setting the ModelAndViewContainer#setRequestHandled flag to true to indicate the response has been handled directly.

Parameters
returnValue:Object

the value returned from the handler method

returnType:MethodParameter

the type of the return value. This type must have previously been passed to supportsReturnType which must have returned true.

mavContainer:ModelAndViewContainer

the ModelAndViewContainer for the current request

webRequest:NativeWebRequest

the current request

Annotations
@Override
@SuppressWarnings:resource
Exceptions
Exception:
if the return value handling results in an error
supportsReturnTypeback to summary
public boolean supportsReturnType(MethodParameter returnType)

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.supportsReturnType.

Doc from org.springframework.web.method.support.HandlerMethodReturnValueHandler.supportsReturnType.

Whether the given method return type is supported by this handler.

Parameters
returnType:MethodParameter

the method return type to check

Returns:boolean

true if this handler supports the supplied return type; false otherwise

Annotations
@Override
org.springframework.web.servlet.mvc.method.annotation back to summary

private Class StreamingResponseBodyReturnValueHandler.StreamingResponseBodyTask

extends Object
implements Callable<Void>
Class Inheritance
  • java.lang.Object
  • org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler.StreamingResponseBodyTask
All Implemented Interfaces
java.util.concurrent.Callable

Field Summary

Modifier and TypeField and Description
private final OutputStream
private final StreamingResponseBody

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Void
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

outputStreamback to summary
private final OutputStream outputStream
streamingBodyback to summary
private final StreamingResponseBody streamingBody

Constructor Detail

StreamingResponseBodyTaskback to summary
public StreamingResponseBodyTask(OutputStream outputStream, StreamingResponseBody streamingBody)

Method Detail

callback to summary
public Void call() throws Exception

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:Void

computed result

Annotations
@Override
Exceptions
Exception:
if unable to compute a result