public class EncoderHttpMessageWriter<T> extends Object implements HttpMessageWriter<T>
HttpMessageWriter interface that delegates
to an Encoder.| Constructor and Description |
|---|
EncoderHttpMessageWriter(Encoder<T> encoder)
Create a
CodecHttpMessageConverter with the given Encoder. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canWrite(ResolvableType type,
MediaType mediaType)
Indicates whether the given class can be written by this converter.
|
protected MediaType |
getDefaultContentType(ResolvableType elementType)
Return the default content type for the given
ResolvableType. |
List<MediaType> |
getWritableMediaTypes()
Return the list of
MediaType objects that can be written by this converter. |
reactor.core.publisher.Mono<Void> |
write(org.reactivestreams.Publisher<? extends T> inputStream,
ResolvableType type,
MediaType contentType,
ReactiveHttpOutputMessage outputMessage)
Write an given object to the given output message.
|
public boolean canWrite(ResolvableType type, MediaType mediaType)
HttpMessageWritercanWrite in interface HttpMessageWriter<T>type - the class to test for writabilitymediaType - the media type to write, can be null if not specified.
Typically the value of an Accept header.true if writable; false otherwisepublic List<MediaType> getWritableMediaTypes()
HttpMessageWriterMediaType objects that can be written by this converter.getWritableMediaTypes in interface HttpMessageWriter<T>public reactor.core.publisher.Mono<Void> write(org.reactivestreams.Publisher<? extends T> inputStream, ResolvableType type, MediaType contentType, ReactiveHttpOutputMessage outputMessage)
HttpMessageWriterwrite in interface HttpMessageWriter<T>inputStream - the input stream to writetype - the stream element type to process.contentType - the content type to use when writing. May be null to
indicate that the default content type of the converter must be used.outputMessage - the message to write toMono of objectprotected MediaType getDefaultContentType(ResolvableType elementType)
ResolvableType.
Used when write(org.reactivestreams.Publisher<? extends T>, org.springframework.core.ResolvableType, org.springframework.http.MediaType, org.springframework.http.ReactiveHttpOutputMessage) is called without a concrete content type.
By default returns the first of encodableMimeTypes, if any.
elementType - the type of element for encodingnull