|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
@ -25,15 +25,17 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} |
|
|
|
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter |
|
|
|
* that can read and write <a href="https://cbor.io/">CBOR</a> data format using |
|
|
|
* HttpMessageConverter} that can read and write the <a href="https://cbor.io/">CBOR</a> |
|
|
|
* <a href="https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor"> |
|
|
|
* data format using <a href="https://github.com/FasterXML/jackson-dataformats-binary/tree/master/cbor"> |
|
|
|
* the dedicated Jackson 2.x extension</a>. |
|
|
|
* the dedicated Jackson 2.x extension</a>. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>By default, this converter supports {@value MediaType#APPLICATION_CBOR_VALUE} media type. This can be |
|
|
|
* <p>By default, this converter supports the {@link MediaType#APPLICATION_CBOR_VALUE} |
|
|
|
* overridden by setting the {@link #setSupportedMediaTypes supportedMediaTypes} property. |
|
|
|
* media type. This can be overridden by setting the {@link #setSupportedMediaTypes |
|
|
|
|
|
|
|
* supportedMediaTypes} property. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>The default constructor uses the default configuration provided by {@link Jackson2ObjectMapperBuilder}. |
|
|
|
* <p>The default constructor uses the default configuration provided by |
|
|
|
|
|
|
|
* {@link Jackson2ObjectMapperBuilder}. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Compatible with Jackson 2.9 and higher. |
|
|
|
* <p>Compatible with Jackson 2.9 and higher. |
|
|
|
* |
|
|
|
* |
|
|
@ -43,17 +45,18 @@ import org.springframework.util.Assert; |
|
|
|
public class MappingJackson2CborHttpMessageConverter extends AbstractJackson2HttpMessageConverter { |
|
|
|
public class MappingJackson2CborHttpMessageConverter extends AbstractJackson2HttpMessageConverter { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Construct a new {@code MappingJackson2CborHttpMessageConverter} using default configuration |
|
|
|
* Construct a new {@code MappingJackson2CborHttpMessageConverter} using the |
|
|
|
* provided by {@code Jackson2ObjectMapperBuilder}. |
|
|
|
* default configuration provided by {@code Jackson2ObjectMapperBuilder}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public MappingJackson2CborHttpMessageConverter() { |
|
|
|
public MappingJackson2CborHttpMessageConverter() { |
|
|
|
this(Jackson2ObjectMapperBuilder.cbor().build()); |
|
|
|
this(Jackson2ObjectMapperBuilder.cbor().build()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Construct a new {@code MappingJackson2CborHttpMessageConverter} with a custom {@link ObjectMapper} |
|
|
|
* Construct a new {@code MappingJackson2CborHttpMessageConverter} with a |
|
|
|
* (must be configured with a {@code CBORFactory} instance). |
|
|
|
* custom {@link ObjectMapper} (must be configured with a {@code CBORFactory} |
|
|
|
* You can use {@link Jackson2ObjectMapperBuilder} to build it easily. |
|
|
|
* instance). |
|
|
|
|
|
|
|
* <p>You can use {@link Jackson2ObjectMapperBuilder} to build it easily. |
|
|
|
* @see Jackson2ObjectMapperBuilder#cbor() |
|
|
|
* @see Jackson2ObjectMapperBuilder#cbor() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper) { |
|
|
|
public MappingJackson2CborHttpMessageConverter(ObjectMapper objectMapper) { |
|
|
|