Move JSON and XML codecs to org.springframework.http.codec

This commit is contained in:
Sebastien Deleuze 2016-06-30 16:59:08 +02:00
parent 8d654584a8
commit b115f1885d
28 changed files with 55 additions and 40 deletions

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.json;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -29,6 +29,7 @@ import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.CodecException;
import org.springframework.core.codec.Decoder;
import org.springframework.core.codec.support.AbstractDecoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.support.DataBufferUtils;
import org.springframework.util.Assert;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.json;
import java.io.IOException;
import java.io.OutputStream;
@ -31,6 +31,7 @@ import reactor.core.publisher.Mono;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.CodecException;
import org.springframework.core.codec.support.AbstractEncoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferFactory;
import org.springframework.util.Assert;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.json;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@ -28,6 +28,7 @@ import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.AbstractDecoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferFactory;
import org.springframework.core.io.buffer.support.DataBufferUtils;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.xml;
import java.util.ArrayList;
import java.util.List;
@ -36,6 +36,7 @@ import reactor.core.publisher.Mono;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.CodecException;
import org.springframework.core.codec.support.AbstractDecoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.util.ClassUtils;
import org.springframework.util.MimeType;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.xml;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlType;
import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.AbstractSingleValueEncoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferFactory;
import org.springframework.util.ClassUtils;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.xml;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.xml;
import java.io.InputStream;
import java.util.ArrayList;
@ -35,6 +35,7 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.AbstractDecoder;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.support.DataBufferUtils;
import org.springframework.util.ClassUtils;

View File

@ -26,8 +26,8 @@ import org.springframework.core.codec.Decoder;
import org.springframework.core.codec.Encoder;
import org.springframework.core.codec.support.ByteBufferDecoder;
import org.springframework.core.codec.support.ByteBufferEncoder;
import org.springframework.core.codec.support.JacksonJsonDecoder;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.http.codec.json.JacksonJsonDecoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.core.codec.support.StringDecoder;
import org.springframework.core.codec.support.StringEncoder;
import org.springframework.http.HttpStatus;

View File

@ -32,10 +32,10 @@ import org.springframework.core.codec.Decoder;
import org.springframework.core.codec.Encoder;
import org.springframework.core.codec.support.ByteBufferDecoder;
import org.springframework.core.codec.support.ByteBufferEncoder;
import org.springframework.core.codec.support.JacksonJsonDecoder;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.core.codec.support.Jaxb2Decoder;
import org.springframework.core.codec.support.Jaxb2Encoder;
import org.springframework.http.codec.json.JacksonJsonDecoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.http.codec.xml.Jaxb2Decoder;
import org.springframework.http.codec.xml.Jaxb2Encoder;
import org.springframework.core.codec.support.StringDecoder;
import org.springframework.core.codec.support.StringEncoder;
import org.springframework.core.convert.converter.Converter;

View File

@ -54,7 +54,7 @@ public class StringDecoderTests extends AbstractDataBufferAllocatingTestCase {
MediaType.APPLICATION_JSON));
assertFalse(this.decoder
.canDecode(ResolvableType.forClass(Integer.class), MediaType.TEXT_PLAIN));
assertFalse(this.decoder.canDecode(ResolvableType.forClass(Pojo.class),
assertFalse(this.decoder.canDecode(ResolvableType.forClass(Object.class),
MediaType.APPLICATION_JSON));
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec;
import javax.xml.bind.annotation.XmlRootElement;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec;
import java.util.Arrays;
@ -28,7 +28,7 @@ import org.springframework.core.ResolvableType;
import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.FlushingDataBuffer;
import org.springframework.http.codec.SseEventEncoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.util.MimeType;
import org.springframework.web.reactive.sse.SseEvent;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.json;
import java.lang.reflect.Method;
import java.util.Arrays;
@ -29,6 +29,8 @@ import org.springframework.core.ResolvableType;
import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.MediaType;
import org.springframework.http.codec.Pojo;
import org.springframework.http.codec.json.JacksonJsonDecoder;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.json;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
@ -27,6 +27,8 @@ import org.springframework.core.ResolvableType;
import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.MediaType;
import org.springframework.http.codec.Pojo;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.json;
import java.nio.charset.StandardCharsets;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.xml;
import java.util.List;
import javax.xml.namespace.QName;
@ -34,6 +34,9 @@ import org.springframework.core.codec.support.jaxb.XmlTypeWithNameAndNamespace;
import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.MediaType;
import org.springframework.http.codec.Pojo;
import org.springframework.http.codec.xml.Jaxb2Decoder;
import org.springframework.http.codec.xml.XmlEventDecoder;
import static org.junit.Assert.*;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.xml;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -31,6 +31,7 @@ import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.support.DataBufferTestUtils;
import org.springframework.core.io.buffer.support.DataBufferUtils;
import org.springframework.http.MediaType;
import org.springframework.http.codec.Pojo;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.custommonkey.xmlunit.XMLAssert.fail;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.core.codec.support;
package org.springframework.http.codec.xml;
import javax.xml.stream.events.XMLEvent;
@ -23,6 +23,7 @@ import reactor.core.publisher.Flux;
import reactor.core.test.TestSubscriber;
import org.springframework.core.io.buffer.AbstractDataBufferAllocatingTestCase;
import org.springframework.http.codec.xml.XmlEventDecoder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

View File

@ -34,7 +34,7 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.test.TestSubscriber;
import org.springframework.core.codec.support.Pojo;
import org.springframework.http.codec.Pojo;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;

View File

@ -19,7 +19,7 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.core.Ordered;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.web.context.support.StaticWebApplicationContext;
import org.springframework.web.reactive.result.view.HttpMessageConverterView;
import org.springframework.web.reactive.result.view.UrlBasedViewResolver;

View File

@ -35,9 +35,9 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.core.codec.support.Jaxb2Decoder;
import org.springframework.core.codec.support.Jaxb2Encoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.http.codec.xml.Jaxb2Decoder;
import org.springframework.http.codec.xml.Jaxb2Encoder;
import org.springframework.core.codec.support.StringDecoder;
import org.springframework.core.codec.support.StringEncoder;
import org.springframework.core.convert.ConversionService;

View File

@ -38,8 +38,8 @@ import rx.Observable;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.ByteBufferEncoder;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.core.codec.support.Jaxb2Encoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.http.codec.xml.Jaxb2Encoder;
import org.springframework.core.codec.support.StringEncoder;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.core.convert.support.ReactiveStreamsToCompletableFutureConverter;

View File

@ -43,7 +43,7 @@ import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.annotation.SynthesizingMethodParameter;
import org.springframework.core.codec.Decoder;
import org.springframework.core.codec.support.JacksonJsonDecoder;
import org.springframework.http.codec.json.JacksonJsonDecoder;
import org.springframework.core.codec.support.StringDecoder;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.core.convert.support.ReactiveStreamsToCompletableFutureConverter;

View File

@ -39,7 +39,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.buffer.DataBuffer;

View File

@ -27,8 +27,8 @@ import reactor.core.publisher.Mono;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.ByteBufferEncoder;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.core.codec.support.Jaxb2Encoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.http.codec.xml.Jaxb2Encoder;
import org.springframework.core.codec.support.StringEncoder;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;

View File

@ -31,8 +31,8 @@ import rx.Single;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.ByteBufferEncoder;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.core.codec.support.Jaxb2Encoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.http.codec.xml.Jaxb2Encoder;
import org.springframework.core.codec.support.StringEncoder;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.core.convert.support.ReactiveStreamsToCompletableFutureConverter;

View File

@ -31,8 +31,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.codec.Encoder;
import org.springframework.core.codec.support.ByteBufferDecoder;
import org.springframework.core.codec.support.JacksonJsonDecoder;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.http.codec.json.JacksonJsonDecoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.core.codec.support.StringDecoder;
import org.springframework.http.MediaType;
import org.springframework.http.client.reactive.ReactorHttpClientRequestFactory;

View File

@ -32,8 +32,8 @@ import org.junit.Test;
import reactor.core.test.TestSubscriber;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.support.JacksonJsonEncoder;
import org.springframework.core.codec.support.Jaxb2Encoder;
import org.springframework.http.codec.json.JacksonJsonEncoder;
import org.springframework.http.codec.xml.Jaxb2Encoder;
import org.springframework.core.codec.support.StringEncoder;
import org.springframework.core.io.buffer.support.DataBufferTestUtils;
import org.springframework.http.HttpMethod;