Class RequestMappingHandlerAdapter

java.lang.Object
org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, DispatchExceptionHandler, HandlerAdapter

public class RequestMappingHandlerAdapter extends Object implements HandlerAdapter, DispatchExceptionHandler, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Supports the invocation of @RequestMapping handler methods.
Since:
5.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • RequestMappingHandlerAdapter

      public RequestMappingHandlerAdapter()
  • Method Details

    • setMessageReaders

      public void setMessageReaders(List<org.springframework.http.codec.HttpMessageReader<?>> messageReaders)
      Configure HTTP message readers to de-serialize the request body with.

      By default this is set to ServerCodecConfigurer's readers with defaults.

    • getMessageReaders

      public List<org.springframework.http.codec.HttpMessageReader<?>> getMessageReaders()
      Return the configurer for HTTP message readers.
    • setWebBindingInitializer

      public void setWebBindingInitializer(@Nullable org.springframework.web.bind.support.WebBindingInitializer webBindingInitializer)
      Provide a WebBindingInitializer with "global" initialization to apply to every DataBinder instance.
    • getWebBindingInitializer

      @Nullable public org.springframework.web.bind.support.WebBindingInitializer getWebBindingInitializer()
      Return the configured WebBindingInitializer, or null if none.
    • setArgumentResolverConfigurer

      public void setArgumentResolverConfigurer(@Nullable ArgumentResolverConfigurer configurer)
      Configure resolvers for controller method arguments.
    • getArgumentResolverConfigurer

      @Nullable public ArgumentResolverConfigurer getArgumentResolverConfigurer()
      Return the configured resolvers for controller method arguments.
    • setReactiveAdapterRegistry

      public void setReactiveAdapterRegistry(@Nullable org.springframework.core.ReactiveAdapterRegistry registry)
      Configure the registry for adapting various reactive types.

      By default this is an instance of ReactiveAdapterRegistry with default settings.

    • getReactiveAdapterRegistry

      @Nullable public org.springframework.core.ReactiveAdapterRegistry getReactiveAdapterRegistry()
      Return the configured registry for adapting reactive types.
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      A ConfigurableApplicationContext is expected for resolving expressions in method argument default values as well as for detecting @ControllerAdvice beans.
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • supports

      public boolean supports(Object handler)
      Description copied from interface: HandlerAdapter
      Whether this HandlerAdapter supports the given handler.
      Specified by:
      supports in interface HandlerAdapter
      Parameters:
      handler - the handler object to check
      Returns:
      whether the handler is supported
    • handle

      public reactor.core.publisher.Mono<HandlerResult> handle(org.springframework.web.server.ServerWebExchange exchange, Object handler)
      Description copied from interface: HandlerAdapter
      Handle the request with the given handler.

      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.

      Specified by:
      handle in interface HandlerAdapter
      Parameters:
      exchange - current server exchange
      handler - the selected handler which must have been previously checked via HandlerAdapter.supports(Object)
      Returns:
      Mono that emits a single HandlerResult or none if the request has been fully handled and doesn't require further handling.
    • handleError

      public reactor.core.publisher.Mono<HandlerResult> handleError(org.springframework.web.server.ServerWebExchange exchange, Throwable ex)
      Description copied from interface: DispatchExceptionHandler
      Handler the given exception and resolve it to HandlerResult that can be used for rendering an HTTP response.
      Specified by:
      handleError in interface DispatchExceptionHandler
      Parameters:
      exchange - the current exchange
      ex - the exception to handle
      Returns:
      a Mono that emits a HandlerResult or the original exception