public class RequestMappingHandlerAdapter extends Object implements HandlerAdapter, BeanFactoryAware, InitializingBean
@RequestMapping
methods.Constructor and Description |
---|
RequestMappingHandlerAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
protected InvocableHandlerMethod |
findExceptionHandler(HandlerMethod handlerMethod,
Exception exception) |
List<HandlerMethodArgumentResolver> |
getArgumentResolvers()
Return the configured argument resolvers.
|
ConfigurableBeanFactory |
getBeanFactory() |
ConversionService |
getConversionService()
Return the configured ConversionService.
|
List<HandlerMethodArgumentResolver> |
getCustomArgumentResolvers()
Return the custom argument resolvers.
|
List<HttpMessageReader<?>> |
getMessageReaders()
Return the configured message readers.
|
ReactiveAdapterRegistry |
getReactiveAdapterRegistry() |
Validator |
getValidator()
Return the configured Validator.
|
reactor.core.publisher.Mono<HandlerResult> |
handle(ServerWebExchange exchange,
Object handler)
Handle the request with the given handler.
|
protected List<HandlerMethodArgumentResolver> |
initArgumentResolvers() |
void |
setArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
Configure the complete list of supported argument types thus overriding
the resolvers that would otherwise be configured by default.
|
void |
setBeanFactory(BeanFactory beanFactory)
A
ConfigurableBeanFactory is expected for resolving expressions
in method argument default values. |
void |
setConversionService(ConversionService conversionService)
Configure a ConversionService for type conversion of controller method
arguments as well as for converting from different async types to
Flux and Mono . |
void |
setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
Provide custom argument resolvers without overriding the built-in ones.
|
void |
setMessageReaders(List<HttpMessageReader<?>> messageReaders)
Configure message readers to de-serialize the request body with.
|
void |
setReactiveAdapterRegistry(ReactiveAdapterRegistry registry) |
void |
setValidator(Validator validator)
Configure a Validator for validation of controller method arguments such
as
@RequestBody . |
boolean |
supports(Object handler)
Whether this
HandlerAdapter supports the given handler . |
public void setCustomArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)
public List<HandlerMethodArgumentResolver> getCustomArgumentResolvers()
public void setArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
public List<HandlerMethodArgumentResolver> getArgumentResolvers()
public void setMessageReaders(List<HttpMessageReader<?>> messageReaders)
public List<HttpMessageReader<?>> getMessageReaders()
public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
public ReactiveAdapterRegistry getReactiveAdapterRegistry()
public void setConversionService(ConversionService conversionService)
Flux
and Mono
.
TODO: this may be replaced by DataBinderpublic ConversionService getConversionService()
public void setValidator(Validator validator)
@RequestBody
.
TODO: this may be replaced by DataBinderpublic Validator getValidator()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
ConfigurableBeanFactory
is expected for resolving expressions
in method argument default values.setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.BeansException
- in case of initialization errorsBeanInitializationException
public ConfigurableBeanFactory getBeanFactory()
public void afterPropertiesSet() throws Exception
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
Exception
- in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.protected List<HandlerMethodArgumentResolver> initArgumentResolvers()
public boolean supports(Object handler)
HandlerAdapter
HandlerAdapter
supports the given handler
.supports
in interface HandlerAdapter
handler
- handler object to checkpublic reactor.core.publisher.Mono<HandlerResult> handle(ServerWebExchange exchange, Object handler)
HandlerAdapter
Implementations are encouraged to handle exceptions resulting from the invocation of a handler in order and if necessary to return an alternate result that represents an error response.
Furthermore since an async HandlerResult
may produce an error
later during result handling implementations are also encouraged to
set an exception
handler
on the HandlerResult
so that may also be applied later
after result handling.
handle
in interface HandlerAdapter
exchange
- current server exchangehandler
- the selected handler which must have been previously
checked via HandlerAdapter.supports(Object)
Mono
that emits a single HandlerResult
or none if
the request has been fully handled and doesn't require further handling.protected InvocableHandlerMethod findExceptionHandler(HandlerMethod handlerMethod, Exception exception)