HttpMessageWriter that can write a Resource.
Also an implementation of HttpMessageWriter with support for writing one
or more ResourceRegion's based on the HTTP ranges specified in the request.
For reading to a Resource, use ResourceDecoder wrapped with
DecoderHttpMessageReader.
ResourceEncoder, ResourceRegionEncoder, HttpRange
| Modifier and Type | Field and Description |
|---|---|
| private final ResourceEncoder | |
| private static final Log | |
| private final List | |
| private static final ResolvableType | |
| private final ResourceRegionEncoder |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Mono | addDefaultHeaders(ReactiveHttpOutputMessage message, Resource resource, MediaType contentType, Map<String, Object> hints)
Adds the default headers for the given resource to the given message. |
| public void | addHeaders(ReactiveHttpOutputMessage message, Resource resource, MediaType contentType, Map<String, Object> hints)
Deprecated
for removal since 6.1. since 6.1, in favor of
addDefaultHeaders(ReactiveHttpOutputMessage, Resource, MediaType, Map),
for removal = 6.2
Adds the default headers for the given resource to the given message. |
| 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. |
| private Mono | encodeAndWriteRegions(Publisher<? extends ResourceRegion> publisher, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints)
|
| private static MediaType | |
| public List | getWritableMediaTypes()
Implements org. Return the list of media types supported by this Writer. |
| private static Mono | |
| public Mono | write(Publisher<? extends Resource>
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 Resource> 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
|
| private Mono | writeResource(Resource resource, ResolvableType type, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints)
|
| private Mono | writeSingleRegion(ResourceRegion region, ReactiveHttpOutputMessage message, Map<String, Object> hints)
|
| private static Mono | zeroCopy(Resource resource, ResourceRegion region, ReactiveHttpOutputMessage message, Map<String, Object> hints)
|
| encoder | back to summary |
|---|---|
| private final ResourceEncoder encoder | |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| mediaTypes | back to summary |
|---|---|
| private final List<MediaType> mediaTypes | |
| REGION_TYPE | back to summary |
|---|---|
| private static final ResolvableType REGION_TYPE | |
| regionEncoder | back to summary |
|---|---|
| private final ResourceRegionEncoder regionEncoder | |
| ResourceHttpMessageWriter | back to summary |
|---|---|
| public ResourceHttpMessageWriter() | |
| ResourceHttpMessageWriter | back to summary |
|---|---|
| public ResourceHttpMessageWriter(int bufferSize) | |
| addDefaultHeaders | back to summary |
|---|---|
| public Mono Adds the default headers for the given resource to the given message.
| |
| addHeaders | back to summary |
|---|---|
| public void addHeaders(ReactiveHttpOutputMessage message, Resource resource, MediaType contentType, Map<String, Object> hints)
Deprecated for removal since 6.1. since 6.1, in favor of Adds the default headers for the given resource to the given message.
| |
| 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.
| |
| encodeAndWriteRegions | back to summary |
|---|---|
| private Mono | |
| getResourceMediaType | back to summary |
|---|---|
| private static MediaType getResourceMediaType(MediaType mediaType, Resource resource, Map<String, Object> hints) | |
| 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 | |
| lengthOf | back to summary |
|---|---|
| private static Mono | |
| 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
| |
| writeResource | back to summary |
|---|---|
| private Mono | |
| writeSingleRegion | back to summary |
|---|---|
| private Mono | |
| zeroCopy | back to summary |
|---|---|
private static Mono
| |