Class ResponseEntityResultHandler
java.lang.Object
org.springframework.web.reactive.result.HandlerResultHandlerSupport
org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler
org.springframework.web.reactive.result.method.annotation.ResponseEntityResultHandler
- All Implemented Interfaces:
Ordered
,HandlerResultHandler
public class ResponseEntityResultHandler
extends AbstractMessageWriterResultHandler
implements HandlerResultHandler
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.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler
COROUTINES_FLOW_CLASS_NAME
Fields inherited from class org.springframework.web.reactive.result.HandlerResultHandlerSupport
logger
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorsConstructorDescriptionResponseEntityResultHandler
(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver) Basic constructor with a defaultReactiveAdapterRegistry
.ResponseEntityResultHandler
(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry) Constructor with anReactiveAdapterRegistry
instance. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
handleResult
(ServerWebExchange exchange, HandlerResult result) Process the given result modifying response headers and/or writing data to the response.boolean
supports
(HandlerResult result) Whether this handler supports the givenHandlerResult
.Methods inherited from class org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler
getMessageWriters, writeBody, writeBody
Methods inherited from class org.springframework.web.reactive.result.HandlerResultHandlerSupport
getAdapter, getAdapterRegistry, getContentTypeResolver, getOrder, selectMediaType, setOrder
-
Constructor Details
-
ResponseEntityResultHandler
public ResponseEntityResultHandler(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver) Basic constructor with a defaultReactiveAdapterRegistry
.- Parameters:
writers
- the writers for serializing to the response bodyresolver
- to determine the requested content type
-
ResponseEntityResultHandler
public ResponseEntityResultHandler(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry) Constructor with anReactiveAdapterRegistry
instance.- Parameters:
writers
- the writers for serializing to the response bodyresolver
- to determine the requested content typeregistry
- for adaptation to reactive types
-
-
Method Details
-
supports
Description copied from interface:HandlerResultHandler
Whether this handler supports the givenHandlerResult
.- Specified by:
supports
in interfaceHandlerResultHandler
- Parameters:
result
- the result object to check- Returns:
- whether or not this object can use the given result
-
handleResult
public reactor.core.publisher.Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result) Description copied from interface:HandlerResultHandler
Process the given result modifying response headers and/or writing data to the response.- Specified by:
handleResult
in interfaceHandlerResultHandler
- Parameters:
exchange
- current server exchangeresult
- the result from the handling- Returns:
Mono<Void>
to indicate when request handling is complete.
-