spring-framework / org.springframework.http.converter

Package org.springframework.http.converter

Types

BufferedImageHttpMessageConverter

open class BufferedImageHttpMessageConverter : HttpMessageConverter<BufferedImage>

Implementation of HttpMessageConverter that can read and write BufferedImage.

By default, this converter can read all media types that are supported by the registered image readers, and writes using the media type of the first available registered image writer. The latter can be overridden by setting the defaultContentType property.

If the cacheDir property is set, this converter will cache image data.

The #process(ImageReadParam) and #process(ImageWriteParam) template methods allow subclasses to override Image I/O parameters.

ByteArrayHttpMessageConverter

open class ByteArrayHttpMessageConverter : AbstractHttpMessageConverter<ByteArray>

Implementation of HttpMessageConverter that can read and write byte arrays.

By default, this converter supports all media types (&#42;&#47;&#42;), and writes with a Content-Type of application/octet-stream. This can be overridden by setting the supportedMediaTypes property.

ObjectToStringHttpMessageConverter

open class ObjectToStringHttpMessageConverter : AbstractHttpMessageConverter<Any>

An HttpMessageConverter that uses StringHttpMessageConverter for reading and writing content and a ConversionService for converting the String content to and from the target object type.

By default, this converter supports the media type text/plain only. This can be overridden through the supportedMediaTypes property.

A usage example:

 <bean class="org.springframework.http.converter.ObjectToStringHttpMessageConverter"> <constructor-arg> <bean class="org.springframework.context.support.ConversionServiceFactoryBean"/> </constructor-arg> </bean> 

ResourceHttpMessageConverter

open class ResourceHttpMessageConverter : AbstractHttpMessageConverter<Resource>

Implementation of HttpMessageConverter that can read/write Resource 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.

ResourceRegionHttpMessageConverter

open class ResourceRegionHttpMessageConverter : AbstractGenericHttpMessageConverter<Any>

Implementation of HttpMessageConverter that can write a single ResourceRegion, or Collections of ResourceRegion.

Exceptions

HttpMessageConversionException

open class HttpMessageConversionException : NestedRuntimeException

Thrown by HttpMessageConverter implementations when a conversion attempt fails.

HttpMessageNotReadableException

open class HttpMessageNotReadableException : HttpMessageConversionException

Thrown by HttpMessageConverter implementations when the HttpMessageConverter#read method fails.

HttpMessageNotWritableException

open class HttpMessageNotWritableException : HttpMessageConversionException

Thrown by HttpMessageConverter implementations when the HttpMessageConverter#write method fails.