org.springframework.web.reactive.result

## Class HandlerResultHandlerSupport

- java.lang.Object
- - org.springframework.web.reactive.result.HandlerResultHandlerSupport

- All Implemented Interfaces:
    Ordered
  Direct Known Subclasses:
    AbstractMessageWriterResultHandler, ViewResolutionResultHandler

      public abstract class HandlerResultHandlerSupport
      extends Object
      implements Ordered

  Base class for `HandlerResultHandler` with support for content negotiation and access to a `ReactiveAdapter` registry.
  Since:
    5.0
  Author:
    Rossen Stoyanchev

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Log` | `logger`

    - ### Fields inherited from interface org.springframework.core.Ordered

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ReactiveAdapter` | `getAdapter(HandlerResult result)` Get a `ReactiveAdapter` for the top-level return value type.
    `ReactiveAdapterRegistry` | `getAdapterRegistry()` Return the configured `ReactiveAdapterRegistry`.
    `RequestedContentTypeResolver` | `getContentTypeResolver()` Return the configured `RequestedContentTypeResolver`.
    `int` | `getOrder()` Get the order value of this object.
    `protected MediaType` | `selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier)` Select the best media type for the current request through a content negotiation algorithm.
    `void` | `setOrder(int order)` Set the order for this result handler relative to others.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected final Log logger

  - ### Constructor Detail

    - #### HandlerResultHandlerSupport

          protected HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver,
                                                ReactiveAdapterRegistry adapterRegistry)

  - ### Method Detail

    - #### getAdapterRegistry

          public ReactiveAdapterRegistry getAdapterRegistry()

      Return the configured `ReactiveAdapterRegistry`.

    - #### getContentTypeResolver

          public RequestedContentTypeResolver getContentTypeResolver()

      Return the configured `RequestedContentTypeResolver`.

    - #### setOrder

          public void setOrder(int order)

      Set the order for this result handler relative to others.

      By default set to `Ordered.LOWEST_PRECEDENCE`, however see Javadoc of subclasses which may change this default.

      Parameters:
        `order` - the order

    - #### getOrder

          public int getOrder()

      Description copied from interface: `Ordered`
      Get the order value of this object.

      Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet `load-on-startup` values).

      Same order values will result in arbitrary sort positions for the affected objects.

      Specified by:
        `getOrder` in interface `Ordered`
      Returns:
        the order value
      See Also:
        `Ordered.HIGHEST_PRECEDENCE`, `Ordered.LOWEST_PRECEDENCE`

    - #### getAdapter

          @Nullable
          protected ReactiveAdapter getAdapter(HandlerResult result)

      Get a `ReactiveAdapter` for the top-level return value type.
      Returns:
        the matching adapter, or `null` if none

    - #### selectMediaType

          @Nullable
          protected MediaType selectMediaType(ServerWebExchange exchange,
                                                        Supplier<List<MediaType>> producibleTypesSupplier)

      Select the best media type for the current request through a content negotiation algorithm.
      Parameters:
        `exchange` - the current request
        `producibleTypesSupplier` - the media types that can be produced for the current request
      Returns:
        the selected media type, or `null` if none