Class AbstractMessageWriterResultHandler
java.lang.Object
org.springframework.web.reactive.result.HandlerResultHandlersupport
org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler
- All Implemented Interfaces:
Ordered
- Direct Known subclasses:
ResponseBodyResultHandler, ResponseEntityResultHandler
Abstract base class for result handlers that handle return values by writing
to the response with
HttpMessageWriter.- since:
- 5.0
- Author:
- Rossen stoyanchev, sebastien Deleuze
-
Field summary
FieldsFields inherited from class HandlerResultHandlersupport
loggerFields inherited from interface Ordered
HIGHEsT_PRECEDENCE, LOWEsT_PRECEDENCE -
Constructor summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver) Constructor withHttpMessageWritersand aRequestedContentTypeResolver.protectedAbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry) Constructor with an additionalReactiveAdapterRegistry.protectedAbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry, List<ErrorResponse.Interceptor> interceptors) Variant ofAbstractMessageWriterResultHandler(List, RequestedContentTypeResolver, ReactiveAdapterRegistry)with additional list ofErrorResponse.Interceptors for return value handling. -
Method summary
Modifier and TypeMethodDescriptionReturn the configuredErrorResponse.Interceptor's.Return the configured message converters.protected voidinvokeErrorResponseInterceptors(ProblemDetail detail, @Nullable ErrorResponse errorResponse) Invoke the configuredErrorResponse.Interceptor's.protected reactor.core.publisher.Mono<Void> writeBody(@Nullable Object body, MethodParameter bodyParameter, @Nullable MethodParameter actualParam, serverWebExchange exchange) Write a given body to the response withHttpMessageWriter.protected reactor.core.publisher.Mono<Void> writeBody(@Nullable Object body, MethodParameter bodyParameter, serverWebExchange exchange) Write a given body to the response withHttpMessageWriter.Methods inherited from class HandlerResultHandlersupport
getAdapter, getAdapterRegistry, getContentTypeResolver, getOrder, selectMediaType, selectMediaType, setOrder
-
Field Details
-
COROUTINEs_FLOW_CLAss_NAME
- see Also:
-
-
Constructor Details
-
AbstractMessageWriterResultHandler
protected AbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver) Constructor withHttpMessageWritersand aRequestedContentTypeResolver.- Parameters:
messageWriters- for serializing Objects to the response body streamcontentTypeResolver- for resolving the requested content type
-
AbstractMessageWriterResultHandler
protected AbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry) Constructor with an additionalReactiveAdapterRegistry.- Parameters:
messageWriters- for serializing Objects to the response body streamcontentTypeResolver- for resolving the requested content typeadapterRegistry- for adapting other reactive types (for example, rx.Observable, rx.single, etc.) to Flux or Mono
-
AbstractMessageWriterResultHandler
protected AbstractMessageWriterResultHandler(List<HttpMessageWriter<?>> messageWriters, RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry, List<ErrorResponse.Interceptor> interceptors) Variant ofAbstractMessageWriterResultHandler(List, RequestedContentTypeResolver, ReactiveAdapterRegistry)with additional list ofErrorResponse.Interceptors for return value handling.- since:
- 6.2
-
-
Method Details
-
getMessageWriters
Return the configured message converters. -
getErrorResponseInterceptors
Return the configuredErrorResponse.Interceptor's.- since:
- 6.2
-
invokeErrorResponseInterceptors
protected void invokeErrorResponseInterceptors(ProblemDetail detail, @Nullable ErrorResponse errorResponse) Invoke the configuredErrorResponse.Interceptor's.- since:
- 6.2
-
writeBody
protected reactor.core.publisher.Mono<Void> writeBody(@Nullable Object body, MethodParameter bodyParameter, serverWebExchange exchange) Write a given body to the response withHttpMessageWriter.- Parameters:
body- the object to writebodyParameter- theMethodParameterof the body to writeexchange- the current exchange- Returns:
- indicates completion or error
- see Also:
-
writeBody
protected reactor.core.publisher.Mono<Void> writeBody(@Nullable Object body, MethodParameter bodyParameter, @Nullable MethodParameter actualParam, serverWebExchange exchange) Write a given body to the response withHttpMessageWriter.- Parameters:
body- the object to writebodyParameter- theMethodParameterof the body to writeactualParam- the actual return type of the method that returned the value; could be different frombodyParameterwhen processingHttpEntityfor exampleexchange- the current exchange- Returns:
- indicates completion or error
- since:
- 5.0.2
-