类 MappingJackson2CborHttpMessageConverter
- java.lang.Object
- org.springframework.http.converter.AbstractHttpMessageConverter<T>
- org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
- org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
- org.springframework.http.converter.cbor.MappingJackson2CborHttpMessageConverter
- 所有已实现的接口:
GenericHttpMessageConverter<Object>,HttpMessageConverter<Object>
public class MappingJackson2CborHttpMessageConverter extends AbstractJackson2HttpMessageConverter
Implementation ofHttpMessageConverterthat can read and write the CBOR data format using the dedicated Jackson 2.x extension.By default, this converter supports the
MediaType.APPLICATION_CBOR_VALUEmedia type. This can be overridden by setting thesupportedMediaTypesproperty.The default constructor uses the default configuration provided by
Jackson2ObjectMapperBuilder.Compatible with Jackson 2.9 and higher.
- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze
字段概要
从类继承的字段 org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
DEFAULT_CHARSET, objectMapper
从类继承的字段 org.springframework.http.converter.AbstractHttpMessageConverter
logger
构造器概要
构造器 构造器 说明 MappingJackson2CborHttpMessageConverter()Construct a newMappingJackson2CborHttpMessageConverterusing the default configuration provided byJackson2ObjectMapperBuilder.MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper)Construct a newMappingJackson2CborHttpMessageConverterwith a customObjectMapper(must be configured with aCBORFactoryinstance).
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidsetObjectMapper(ObjectMapper objectMapper)Set theObjectMapperfor this view.从类继承的方法 org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
canRead, canRead, canWrite, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getObjectMapper, logWarningIfNecessary, read, readInternal, setPrettyPrint, writeInternal, writePrefix, writeSuffix
从类继承的方法 org.springframework.http.converter.AbstractGenericHttpMessageConverter
canWrite, supports, write, writeInternal
从类继承的方法 org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, write
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.http.converter.HttpMessageConverter
getSupportedMediaTypes, read, write
构造器详细资料
MappingJackson2CborHttpMessageConverter
public MappingJackson2CborHttpMessageConverter()
Construct a newMappingJackson2CborHttpMessageConverterusing the default configuration provided byJackson2ObjectMapperBuilder.
MappingJackson2CborHttpMessageConverter
public MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper)
Construct a newMappingJackson2CborHttpMessageConverterwith a customObjectMapper(must be configured with aCBORFactoryinstance).You can use
Jackson2ObjectMapperBuilderto build it easily.
方法详细资料
setObjectMapper
public void setObjectMapper(ObjectMapper objectMapper)
Set theObjectMapperfor this view. If not set, a defaultObjectMapperis used.Setting a custom-configured
ObjectMapperis one way to take further control of the JSON serialization process. For example, an extendedSerializerFactorycan 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. TheObjectMappermust be configured with aCBORFactoryinstance.