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