Top Description Fields Constructors Methods
org.springframework.web.reactive.result.method.annotation

public Class ResponseEntityResultHandler

extends AbstractMessageWriterResultHandler
implements HandlerResultHandler
Class Inheritance
All Implemented Interfaces
org.springframework.web.reactive.HandlerResultHandler
Imports
java.net.URI, java.time.Instant, java.util.List, .Set, reactor.core.publisher.Mono, org.springframework.core.KotlinDetector, .MethodParameter, .ReactiveAdapter, .ReactiveAdapterRegistry, org.springframework.http.HttpEntity, .HttpHeaders, .HttpMethod, .HttpStatus, .ProblemDetail, .RequestEntity, .ResponseEntity, org.springframework.http.codec.HttpMessageWriter, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.ErrorResponse, org.springframework.web.reactive.HandlerResult, .HandlerResultHandler, org.springframework.web.reactive.accept.RequestedContentTypeResolver, org.springframework.web.server.ServerWebExchange

Handles return values of type HttpEntity, ResponseEntity, HttpHeaders, ErrorResponse, and ProblemDetail.

By default the order for this result handler is set to 0. It is generally safe to place it early in the order as it looks for a concrete return type.

Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private static final Set<HttpMethod>
Inherited from org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler:
COROUTINES_FLOW_CLASS_NAME

Constructor Summary

AccessConstructor and Description
public
ResponseEntityResultHandler(List<HttpMessageWriter<?>>
the writers for serializing to the response body
writers
,
RequestedContentTypeResolver
to determine the requested content type
resolver
)

Basic constructor with a default ReactiveAdapterRegistry.

public
ResponseEntityResultHandler(List<HttpMessageWriter<?>>
the writers for serializing to the response body
writers
,
RequestedContentTypeResolver
to determine the requested content type
resolver
,
ReactiveAdapterRegistry
for adaptation to reactive types
registry
)

Constructor with an ReactiveAdapterRegistry instance.

Method Summary

Modifier and TypeMethod and Description
public Mono<Void>
handleResult(ServerWebExchange
current server exchange
exchange
,
HandlerResult
the result from the handling
result
)

Implements org.springframework.web.reactive.HandlerResultHandler.handleResult.

Process the given result modifying response headers and/or writing data to the response.

private boolean
private static Class<?>
public boolean
supports(HandlerResult
the result object to check
result
)

Implements org.springframework.web.reactive.HandlerResultHandler.supports.

Whether this handler supports the given HandlerResult.

Inherited from org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler:
getMessageWriterswriteBodywriteBody

Field Detail

SAFE_METHODSback to summary
private static final Set<HttpMethod> SAFE_METHODS

Constructor Detail

ResponseEntityResultHandlerback to summary
public ResponseEntityResultHandler(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver)

Basic constructor with a default ReactiveAdapterRegistry.

Parameters
writers:List<HttpMessageWriter<?>>

the writers for serializing to the response body

resolver:RequestedContentTypeResolver

to determine the requested content type

ResponseEntityResultHandlerback to summary
public ResponseEntityResultHandler(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry)

Constructor with an ReactiveAdapterRegistry instance.

Parameters
writers:List<HttpMessageWriter<?>>

the writers for serializing to the response body

resolver:RequestedContentTypeResolver

to determine the requested content type

registry:ReactiveAdapterRegistry

for adaptation to reactive types

Method Detail

handleResultback to summary
public Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result)

Implements org.springframework.web.reactive.HandlerResultHandler.handleResult.

Doc from org.springframework.web.reactive.HandlerResultHandler.handleResult.

Process the given result modifying response headers and/or writing data to the response.

Parameters
exchange:ServerWebExchange

current server exchange

result:HandlerResult

the result from the handling

Returns:Mono<Void>

Mono<Void> to indicate when request handling is complete.

Annotations
@Override
@SuppressWarnings:ConstantConditions
isSupportedTypeback to summary
private boolean isSupportedType(Class<?> type)
resolveReturnValueTypeback to summary
private static Class<?> resolveReturnValueType(HandlerResult result)
Annotations
@Nullable
supportsback to summary
public boolean supports(HandlerResult result)

Implements org.springframework.web.reactive.HandlerResultHandler.supports.

Doc from org.springframework.web.reactive.HandlerResultHandler.supports.

Whether this handler supports the given HandlerResult.

Parameters
result:HandlerResult

the result object to check

Returns:boolean

whether this object can use the given result

Annotations
@Override