org.springframework.web.reactive.function.server.support

Class HandlerFunctionAdapter

  • java.lang.Object
    • org.springframework.web.reactive.function.server.support.HandlerFunctionAdapter
  • All Implemented Interfaces:
    HandlerAdapter


    public class HandlerFunctionAdapter
    extends java.lang.Object
    implements HandlerAdapter
    HandlerAdapter implementation that supports HandlerFunctions.
    Since:
    5.0
    Author:
    Arjen Poutsma
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      reactor.core.publisher.Mono<HandlerResult> handle(ServerWebExchange exchange, java.lang.Object handler)
      Handle the request with the given handler.
      boolean supports(java.lang.Object handler)
      Whether this HandlerAdapter supports the given handler.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HandlerFunctionAdapter

        public HandlerFunctionAdapter()
    • Method Detail

      • supports

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

        public reactor.core.publisher.Mono<HandlerResult> handle(ServerWebExchange exchange,
                                                                 java.lang.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.