Top Description Fields Constructors Methods
org.springframework.http.converter.cbor

public Class MappingJackson2CborHttpMessageConverter

extends AbstractJackson2HttpMessageConverter
Class Inheritance
Imports
com.fasterxml.jackson.databind.ObjectMapper, com.fasterxml.jackson.dataformat.cbor.CBORFactory, org.springframework.http.MediaType, org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter, .Jackson2ObjectMapperBuilder, org.springframework.util.Assert

Implementation of 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.

Author
Sebastien Deleuze
Since
5.0

Field Summary

Inherited from org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter:
defaultObjectMapper

Constructor Summary

AccessConstructor and Description
public
MappingJackson2CborHttpMessageConverter()

Construct a new MappingJackson2CborHttpMessageConverter using the default configuration provided by Jackson2ObjectMapperBuilder.

public
MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper)

Construct a new MappingJackson2CborHttpMessageConverter with a custom ObjectMapper (must be configured with a CBORFactory instance).

Method Summary

Modifier and TypeMethod and Description
public void
setObjectMapper(ObjectMapper objectMapper)

Overrides org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.setObjectMapper.

Configure the main ObjectMapper to use for Object conversion.
Inherited from org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter:
canReadcanReadcanWritecustomizeReadercustomizeWritergetCharsetgetContentLengthgetDefaultContentTypegetJavaTypegetJsonEncodinggetMediaTypesForProblemDetailgetObjectMappergetObjectMappersForTypegetSupportedMediaTypeslogWarningIfNecessaryreadreadInternalregisterObjectMappersForTypesetPrettyPrintsetSupportedMediaTypessupportsRepeatableWriteswriteInternalwritePrefixwriteSuffix

Constructor Detail

MappingJackson2CborHttpMessageConverterback to summary
public MappingJackson2CborHttpMessageConverter()

Construct a new MappingJackson2CborHttpMessageConverter using the default configuration provided by Jackson2ObjectMapperBuilder.

MappingJackson2CborHttpMessageConverterback to summary
public MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper)

Construct a new MappingJackson2CborHttpMessageConverter with a custom ObjectMapper (must be configured with a CBORFactory instance).

You can use Jackson2ObjectMapperBuilder to build it easily.

See Also
Jackson2ObjectMapperBuilder#cbor()

Method Detail

setObjectMapperback to summary
public void setObjectMapper(ObjectMapper objectMapper)

Overrides org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.setObjectMapper.

Doc from org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.setObjectMapper.

Configure the main ObjectMapper to use for Object conversion. If not set, a default ObjectMapper instance is created.

Setting a custom-configured ObjectMapper is one way to take further control of the JSON serialization process. For example, an extended com.fasterxml.jackson.databind.ser.SerializerFactory can be configured that provides custom serializers for specific types. Another 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.

Annotations
@Override