public class MappingJackson2CborHttpMessageConverter extends AbstractJackson2HttpMessageConverter
HttpMessageConverter that can read and write the CBOR
data format using
the dedicated Jackson 2.x extension.
By default, this converter supports the MediaType.APPLICATION_CBOR_VALUE
media type. This can be overridden by setting the supportedMediaTypes property.
The default constructor uses the default configuration provided by
Jackson2ObjectMapperBuilder.
Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
DEFAULT_CHARSET, objectMapperlogger| Constructor and Description |
|---|
MappingJackson2CborHttpMessageConverter()
Construct a new
MappingJackson2CborHttpMessageConverter using the
default configuration provided by Jackson2ObjectMapperBuilder. |
MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper)
Construct a new
MappingJackson2CborHttpMessageConverter with a
custom ObjectMapper (must be configured with a CBORFactory
instance). |
| Modifier and Type | Method and Description |
|---|---|
void |
setObjectMapper(ObjectMapper objectMapper)
Set the
ObjectMapper for this view. |
canRead, canRead, canWrite, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getObjectMapper, logWarningIfNecessary, read, readInternal, setPrettyPrint, writeInternal, writePrefix, writeSuffixcanWrite, supports, write, writeInternaladdDefaultHeaders, canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSupportedMediaTypes, read, writepublic MappingJackson2CborHttpMessageConverter()
MappingJackson2CborHttpMessageConverter using the
default configuration provided by Jackson2ObjectMapperBuilder.public MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper)
MappingJackson2CborHttpMessageConverter with a
custom ObjectMapper (must be configured with a CBORFactory
instance).
You can use Jackson2ObjectMapperBuilder to build it easily.
Jackson2ObjectMapperBuilder.cbor()public void setObjectMapper(ObjectMapper objectMapper)
ObjectMapper for this view.
If not set, a default ObjectMapper is used.
Setting a custom-configured ObjectMapper is one way to take further
control of the JSON serialization process. For example, an extended
SerializerFactory
can be configured that provides custom serializers for specific types.
The other option for refining the serialization process is to use Jackson's
provided annotations on the types to be serialized, in which case a
custom-configured ObjectMapper is unnecessary.
The ObjectMapper must be configured with a CBORFactory instance.
setObjectMapper in class AbstractJackson2HttpMessageConverter