HttpMessageWriter that wraps and delegates to an Encoder.
Also a HttpMessageWriter that pre-resolves encoding hints
from the extra information available on the server side such as the request
or controller method annotations.
| Modifier and Type | Field and Description |
|---|---|
| private final MediaType | |
| private final Encoder | |
| private static final Log | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static MediaType | |
| public boolean | canWrite(ResolvableType
the type of object to check elementType, MediaType the media type for the write (possibly mediaType)null)Implements org. Whether the given object type is supported by this writer. |
| public Encoder | |
| public List | getWritableMediaTypes()
Implements org. Return the list of media types supported by this Writer. |
| public List | getWritableMediaTypes(ResolvableType
the type of element to encode elementType)Overrides default org. Return the list of media types supported by this Writer for the given type of element. |
| protected Map | getWriteHints(ResolvableType streamType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response)
Get additional hints for encoding for example based on the server request or annotations from controller method parameters. |
| private static MediaType | |
| private static void | |
| private boolean | |
| private boolean | |
| private MediaType | |
| private static boolean | |
| public Mono | write(Publisher<? extends T>
the objects to write inputStream, ResolvableType the type of objects in the stream which must have been
previously checked via elementType, MediaType canWrite(ResolvableType, MediaType)the content type for the write (possibly mediaType, ReactiveHttpOutputMessage null to
indicate that the default content type of the writer must be used)the message to write to message, Map<String, Object> additional information about how to encode and write hints)Implements org. Write a given stream of object to the output message. |
| public Mono | write(Publisher<? extends T> inputStream, ResolvableType
the actual return type of the method that returned the
value; for annotated controllers, the actualType, ResolvableType MethodParameter can be
accessed via ResolvableType#getSource().the type of Objects in the input stream elementType, MediaType the content type to use (possibly mediaType, ServerHttpRequest null indicating
the default content type of the writer should be used)the current request request, ServerHttpResponse the current response response, Map<String, Object> hints)Overrides default org. Server-side only alternative to
|
| defaultMediaType | back to summary |
|---|---|
| private final MediaType defaultMediaType
| |
| encoder | back to summary |
|---|---|
| private final Encoder<T> encoder | |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| mediaTypes | back to summary |
|---|---|
| private final List<MediaType> mediaTypes | |
| EncoderHttpMessageWriter | back to summary |
|---|---|
| public EncoderHttpMessageWriter(Encoder<T> encoder) Create an instance wrapping the given | |
| addDefaultCharset | back to summary |
|---|---|
| private static MediaType addDefaultCharset(MediaType main, MediaType defaultType) | |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(ResolvableType elementType, MediaType mediaType) Implements org. Doc from org. Whether the given object type is supported by this writer.
| |
| getEncoder | back to summary |
|---|---|
| public Encoder Return the | |
| getWritableMediaTypes | back to summary |
|---|---|
| public List Implements org. Doc from org. Return the list of media types supported by this Writer. The list may not
apply to every possible target element type and calls to this method should
typically be guarded via | |
| getWritableMediaTypes | back to summary |
|---|---|
| public List Overrides default org. Doc from org. Return the list of media types supported by this Writer for the given type
of element. This list may differ from
| |
| getWriteHints | back to summary |
|---|---|
| protected Map Get additional hints for encoding for example based on the server request
or annotations from controller method parameters. By default, delegate to
the encoder if it is an instance of | |
| initDefaultMediaType | back to summary |
|---|---|
private static MediaType initDefaultMediaType(List<MediaType> mediaTypes)
| |
| initLogger | back to summary |
|---|---|
| private static void initLogger(Encoder<?> encoder) | |
| isStreamingMediaType | back to summary |
|---|---|
| private boolean isStreamingMediaType(MediaType mediaType) | |
| matchParameters | back to summary |
|---|---|
| private boolean matchParameters(MediaType streamingMediaType, MediaType mediaType) | |
| updateContentType | back to summary |
|---|---|
private MediaType updateContentType(ReactiveHttpOutputMessage message, MediaType mediaType)
| |
| useFallback | back to summary |
|---|---|
| private static boolean useFallback(MediaType main, MediaType fallback) | |
| write | back to summary |
|---|---|
| public Mono Implements org. Doc from org. Write a given stream of object to the output message.
| |
| write | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Server-side only alternative to
| |