HttpMessageConverter that can read/write Resources
and supports byte range requests.
By default, this converter can read all media types. The MediaTypeFactory is used
to determine the Content-Type of written resources.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | ResourceHttpMessageConverter()
Create a new instance of the |
| public | ResourceHttpMessageConverter(boolean
whether the converter should support
read streaming, i.e. convert to supportsReadStreaming)InputStreamResourceCreate a new instance of the |
| Modifier and Type | Method and Description |
|---|---|
| public void | addDefaultHeaders(HttpOutputMessage message, Resource resource, MediaType contentType)
Adds the default headers for the given resource to the given message. |
| protected Long | getContentLength(Resource
the type to return the content length for resource, MediaType contentType)Overrides org. Returns the content length for the given type. |
| protected MediaType | getDefaultContentType(Resource
the type to return the content type for resource)Overrides org. Returns the default content type for the given type. |
| protected Resource | readInternal(Class<? extends Resource>
the type of object to return clazz, HttpInputMessage the HTTP input message to read from inputMessage)Implements abstract org. Abstract template method that reads the actual object. |
| protected boolean | supports(Class<?>
the class to test for support clazz)Implements abstract org. Indicates whether the given class is supported by this converter. |
| protected boolean | supportsRepeatableWrites(Resource
the object t resource)Overrides org. Indicates whether this message converter can write the given object multiple times. |
| protected void | |
| protected void | writeInternal(Resource
the object to write to the output message resource, HttpOutputMessage the HTTP output message to write to outputMessage)Implements abstract org. Abstract template method that writes the actual body. |
| supportsReadStreaming | back to summary |
|---|---|
| private final boolean supportsReadStreaming | |
| ResourceHttpMessageConverter | back to summary |
|---|---|
| public ResourceHttpMessageConverter() Create a new instance of the | |
| ResourceHttpMessageConverter | back to summary |
|---|---|
| public ResourceHttpMessageConverter(boolean supportsReadStreaming) Create a new instance of the
| |
| addDefaultHeaders | back to summary |
|---|---|
| public void addDefaultHeaders(HttpOutputMessage message, Resource resource, MediaType contentType) throws IOException Adds the default headers for the given resource to the given message.
| |
| getContentLength | back to summary |
|---|---|
| protected Long getContentLength(Resource resource, MediaType contentType) throws IOException Overrides org. Doc from org. Returns the content length for the given type. By default, this returns | |
| getDefaultContentType | back to summary |
|---|---|
| protected MediaType getDefaultContentType(Resource resource) Overrides org. Doc from org. Returns the default content type for the given type. Called when By default, this returns the first element of the
| |
| readInternal | back to summary |
|---|---|
| protected Resource readInternal(Class<? extends Resource> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException Implements abstract org. Doc from org. Abstract template method that reads the actual object. Invoked from
| |
| supports | back to summary |
|---|---|
| protected boolean supports(Class<?> clazz) Implements abstract org. Doc from org. Indicates whether the given class is supported by this converter. | |
| supportsRepeatableWrites | back to summary |
|---|---|
| protected boolean supportsRepeatableWrites(Resource resource) Overrides org. Doc from org. Indicates whether this message converter can write the given object multiple times. Default implementation returns | |
| writeContent | back to summary |
|---|---|
| protected void writeContent(Resource resource, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException | |
| writeInternal | back to summary |
|---|---|
| protected void writeInternal(Resource resource, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException Implements abstract org. Doc from org. Abstract template method that writes the actual body. Invoked from
| |