|
|
|
@ -41,18 +41,20 @@ import org.springframework.web.reactive.result.method.HandlerMethodArgumentResol |
|
|
|
* overriding the relevant methods for your needs. |
|
|
|
* overriding the relevant methods for your needs. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Brian Clozel |
|
|
|
* @author Brian Clozel |
|
|
|
|
|
|
|
* @author Rossen Stoyanchev |
|
|
|
* @since 5.0 |
|
|
|
* @since 5.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public interface WebReactiveConfigurer { |
|
|
|
public interface WebReactiveConfigurer { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Configure how the requested content type is resolved. |
|
|
|
* Configure how the content type requested for the response is resolved. |
|
|
|
* <p>The given builder will create a composite of multiple |
|
|
|
* <p>The given builder will create a composite of multiple |
|
|
|
* {@link RequestedContentTypeResolver}s, each defining a way to resolve the |
|
|
|
* {@link RequestedContentTypeResolver}s, each defining a way to resolve |
|
|
|
* the requested content type (accept HTTP header, path extension, parameter, etc). |
|
|
|
* the the requested content type (accept HTTP header, path extension, |
|
|
|
* @param builder factory that creates a {@link CompositeContentTypeResolver} instance |
|
|
|
* parameter, etc). |
|
|
|
|
|
|
|
* @param builder factory that creates a {@link CompositeContentTypeResolver} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void configureRequestedContentTypeResolver(RequestedContentTypeResolverBuilder builder) { |
|
|
|
default void configureContentTypeResolver(RequestedContentTypeResolverBuilder builder) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -79,71 +81,84 @@ public interface WebReactiveConfigurer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Provide custom argument resolvers without overriding the built-in ones. |
|
|
|
* Provide custom controller method argument resolvers. Such resolvers do |
|
|
|
* @param resolvers a list of resolvers to add to the built-in ones |
|
|
|
* not override and will be invoked after the built-in ones. |
|
|
|
|
|
|
|
* @param resolvers a list of resolvers to add |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { |
|
|
|
default void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Configure the message readers to use for decoding controller method arguments. |
|
|
|
* Configure the message readers to use for decoding the request body where |
|
|
|
* <p>If no message readers are specified, default readers will be added via |
|
|
|
* {@code @RequestBody} and {@code HttpEntity} controller method arguments |
|
|
|
|
|
|
|
* are used. If none are specified, default ones are added based on |
|
|
|
* {@link WebReactiveConfigurationSupport#addDefaultHttpMessageReaders}. |
|
|
|
* {@link WebReactiveConfigurationSupport#addDefaultHttpMessageReaders}. |
|
|
|
* @param readers a list to add message readers to, initially an empty list |
|
|
|
* <p>See {@link #extendMessageReaders(List)} for adding readers |
|
|
|
|
|
|
|
* in addition to the default ones. |
|
|
|
|
|
|
|
* @param readers an empty list to add message readers to |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void configureMessageReaders(List<HttpMessageReader<?>> readers) { |
|
|
|
default void configureMessageReaders(List<HttpMessageReader<?>> readers) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Modify the list of message readers to use for decoding controller method arguments, |
|
|
|
* An alternative to {@link #configureMessageReaders(List)} that allows |
|
|
|
* for example to add some in addition to the ones already configured. |
|
|
|
* modifying the message readers to use after default ones have been added. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void extendMessageReaders(List<HttpMessageReader<?>> readers) { |
|
|
|
default void extendMessageReaders(List<HttpMessageReader<?>> readers) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Add custom {@link Converter}s and {@link Formatter}s. |
|
|
|
* Add custom {@link Converter}s and {@link Formatter}s for performing type |
|
|
|
|
|
|
|
* conversion and formatting of controller method arguments. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void addFormatters(FormatterRegistry registry) { |
|
|
|
default void addFormatters(FormatterRegistry registry) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Provide a custom {@link Validator}, instead of the instance configured by default. |
|
|
|
* Provide a custom {@link Validator}. |
|
|
|
* <p>Only a single instance is allowed, an error will be thrown if multiple |
|
|
|
* <p>By default a validator for standard bean validation is created if |
|
|
|
* {@code Validator}s are returned by {@code WebReactiveConfigurer}s. |
|
|
|
* bean validation api is present on the classpath. |
|
|
|
* The default implementation returns {@code Optional.empty()}. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default Optional<Validator> getValidator() { |
|
|
|
default Optional<Validator> getValidator() { |
|
|
|
return Optional.empty(); |
|
|
|
return Optional.empty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Provide a custom {@link MessageCodesResolver}, instead of using the one |
|
|
|
* Provide a custom {@link MessageCodesResolver} to use for data binding |
|
|
|
* provided by {@link org.springframework.validation.DataBinder} instances. |
|
|
|
* instead of the one created by default in |
|
|
|
* The default implementation returns {@code Optional.empty()}. |
|
|
|
* {@link org.springframework.validation.DataBinder}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default Optional<MessageCodesResolver> getMessageCodesResolver() { |
|
|
|
default Optional<MessageCodesResolver> getMessageCodesResolver() { |
|
|
|
return Optional.empty(); |
|
|
|
return Optional.empty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Configure the message writers to use for encoding return values. |
|
|
|
* Configure the message writers to use to encode the response body based on |
|
|
|
* <p>If no message writers are specified, default writers will be added via |
|
|
|
* the return values of {@code @ResponseBody}, and {@code ResponseEntity} |
|
|
|
|
|
|
|
* controller methods. If none are specified, default ones are added based on |
|
|
|
* {@link WebReactiveConfigurationSupport#addDefaultHttpMessageWriters(List)}. |
|
|
|
* {@link WebReactiveConfigurationSupport#addDefaultHttpMessageWriters(List)}. |
|
|
|
* @param writers a list to add message writers to, initially an empty list |
|
|
|
* <p>See {@link #extendMessageWriters(List)} for adding writers |
|
|
|
|
|
|
|
* in addition to the default ones. |
|
|
|
|
|
|
|
* @param writers a empty list to add message writers to |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void configureMessageWriters(List<HttpMessageWriter<?>> writers) { |
|
|
|
default void configureMessageWriters(List<HttpMessageWriter<?>> writers) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Modify the list of message writers to use for encoding return values, |
|
|
|
* An alternative to {@link #configureMessageWriters(List)} that allows |
|
|
|
* for example to add some in addition to the ones already configured. |
|
|
|
* modifying the message writers to use after default ones have been added. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void extendMessageWriters(List<HttpMessageWriter<?>> writers) { |
|
|
|
default void extendMessageWriters(List<HttpMessageWriter<?>> writers) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Configure view resolution for supporting template engines. |
|
|
|
* Configure view resolution for processing the return values of controller |
|
|
|
|
|
|
|
* methods that rely on resolving a |
|
|
|
|
|
|
|
* {@link org.springframework.web.reactive.result.view.View} to render |
|
|
|
|
|
|
|
* the response with. By default all controller methods rely on view |
|
|
|
|
|
|
|
* resolution unless annotated with {@code @ResponseBody} or explicitly |
|
|
|
|
|
|
|
* return {@code ResponseEntity}. A view may be specified explicitly with |
|
|
|
|
|
|
|
* a String return value or implicitly, e.g. {@code void} return value. |
|
|
|
* @see ViewResolverRegistry |
|
|
|
* @see ViewResolverRegistry |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
default void configureViewResolvers(ViewResolverRegistry registry) { |
|
|
|
default void configureViewResolvers(ViewResolverRegistry registry) { |
|
|
|
|