Interface WebResponseBody

All Superinterfaces:
ResponseBody

public interface WebResponseBody extends ResponseBody

A response body with payload encoding support.

Implementors should rely on MediaTypeConverter to encode a payload based on the content type of the response.

If no content-type header is specified in the response when encoding the payload, implementors may use the definition of the route serving the resource and especially the produced media type when specified to determine the converter to use.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Method Details

    • transform

      Description copied from interface: ResponseBody

      Transforms the payload publisher.

      This can be used in an exchange interceptor in order to decorate response data publisher.

      Specified by:
      transform in interface ResponseBody
      Parameters:
      transformer - a request payload publisher transformer
      Returns:
      the request body
    • encoder

      <T> OutboundDataEncoder<T> encoder()

      Returns an encoder to encode a payload based on the content type of the request.

      Type Parameters:
      T - the type to encode
      Returns:
      an encoder
    • encoder

      <T> OutboundDataEncoder<T> encoder(Class<T> type)

      Returns an encoder to encode a payload of the specified type based on the content type of the request.

      Type Parameters:
      T - the type to encode
      Parameters:
      type - a class of T
      Returns:
      an encoder
    • encoder

      <T> OutboundDataEncoder<T> encoder(Type type)

      Returns an encoder to encode a payload of the specified type based on the content type of the request.

      Type Parameters:
      T - the type to encode
      Parameters:
      type - the type to encode
      Returns:
      an encoder
    • sseEncoder

      <T> WebResponseBody.SseEncoder<T> sseEncoder(String mediaType)

      Returns a server-sent events encoder to encode event's data in the specified media type.

      Type Parameters:
      T - the type to encode
      Parameters:
      mediaType - the target media type
      Returns:
      a SSE encoder
    • sseEncoder

      <T> WebResponseBody.SseEncoder<T> sseEncoder(String mediaType, Class<T> type)

      Returns a server-sent events encoder to encode event's data of the specified type in the specified media type.

      Type Parameters:
      T - the type to encode
      Parameters:
      mediaType - the target media type
      type - a class of T
      Returns:
      a SSE encoder
    • sseEncoder

      <T> WebResponseBody.SseEncoder<T> sseEncoder(String mediaType, Type type)

      Returns a server-sent events encoder to encode event's data of the specified type in the specified media type.

      Type Parameters:
      T - the type to encode
      Parameters:
      mediaType - the target media type
      type - the type to encode
      Returns:
      a SSE encoder