org.springframework.http.converter
Class ResourceHttpMessageConverter
java.lang.Object
org.springframework.http.converter.ResourceHttpMessageConverter
- All Implemented Interfaces:
- HttpMessageConverter<Resource>
public class ResourceHttpMessageConverter
- extends java.lang.Object
- implements HttpMessageConverter<Resource>
Implementation of HttpMessageConverter
that can read and write Resources
.
By default, this converter can read all media types. The Java Activation Framework (JAF) - if available - is used
to determine the Content-Type
of written resources. If JAF is not available, application/octet-stream
is used.
- Since:
- 3.0.2
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceHttpMessageConverter
public ResourceHttpMessageConverter()
canRead
public boolean canRead(java.lang.Class<?> clazz,
MediaType mediaType)
- Specified by:
canRead
in interface HttpMessageConverter<Resource>
canWrite
public boolean canWrite(java.lang.Class<?> clazz,
MediaType mediaType)
- Specified by:
canWrite
in interface HttpMessageConverter<Resource>
getSupportedMediaTypes
public java.util.List<MediaType> getSupportedMediaTypes()
- Specified by:
getSupportedMediaTypes
in interface HttpMessageConverter<Resource>
read
public Resource read(java.lang.Class<? extends Resource> clazz,
HttpInputMessage inputMessage)
throws java.io.IOException,
HttpMessageNotReadableException
- Specified by:
read
in interface HttpMessageConverter<Resource>
- Throws:
java.io.IOException
HttpMessageNotReadableException
write
public void write(Resource resource,
MediaType contentType,
HttpOutputMessage outputMessage)
throws java.io.IOException,
HttpMessageNotWritableException
- Specified by:
write
in interface HttpMessageConverter<Resource>
- Throws:
java.io.IOException
HttpMessageNotWritableException
getContentLength
protected java.lang.Long getContentLength(Resource resource,
MediaType contentType)
throws java.io.IOException
- Throws:
java.io.IOException