Browse Source

Polish

pull/1352/merge
Rossen Stoyanchev 8 years ago
parent
commit
9e96cfa7cd
  1. 43
      spring-web/src/main/java/org/springframework/http/codec/AbstractCodecConfigurer.java
  2. 9
      spring-web/src/main/java/org/springframework/http/codec/ClientCodecConfigurer.java

43
spring-web/src/main/java/org/springframework/http/codec/AbstractCodecConfigurer.java

@ -41,7 +41,7 @@ import org.springframework.util.Assert; @@ -41,7 +41,7 @@ import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
/**
* Base class for client or server codec configurers.
* Base class for client or server HTTP message reader and writer configurers.
*
* @author Rossen Stoyanchev
* @since 5.0
@ -103,13 +103,13 @@ public abstract class AbstractCodecConfigurer { @@ -103,13 +103,13 @@ public abstract class AbstractCodecConfigurer {
List<HttpMessageReader<?>> result = new ArrayList<>();
addDefaultTypedReaders(result);
addCustomTypedReaders(result);
customCodec().addTypedReadersTo(result);
addDefaultObjectReaders(result);
addCustomObjectReaders(result);
customCodec().addObjectReadersTo(result);
// String + "*/*"
defaultCodec().addStringReaderTo(result);
return result;
}
@ -124,13 +124,6 @@ public abstract class AbstractCodecConfigurer { @@ -124,13 +124,6 @@ public abstract class AbstractCodecConfigurer {
defaultCodec().addStringReaderTextOnlyTo(result);
}
/**
* Add custom, concrete, Java type readers.
*/
protected void addCustomTypedReaders(List<HttpMessageReader<?>> result) {
customCodec().addTypedReadersTo(result);
}
/**
* Add built-in, Object-based readers.
*/
@ -143,14 +136,6 @@ public abstract class AbstractCodecConfigurer { @@ -143,14 +136,6 @@ public abstract class AbstractCodecConfigurer {
}
}
/**
* Add custom, Object-based readers.
*/
protected void addCustomObjectReaders(List<HttpMessageReader<?>> result) {
customCodec().addObjectReadersTo(result);
}
/**
* Prepare a list of HTTP message writers.
*/
@ -159,14 +144,13 @@ public abstract class AbstractCodecConfigurer { @@ -159,14 +144,13 @@ public abstract class AbstractCodecConfigurer {
List<HttpMessageWriter<?>> result = new ArrayList<>();
addDefaultTypedWriter(result);
addCustomTypedWriter(result);
customCodec().addTypedWritersTo(result);
addDefaultObjectWriters(result);
addCustomObjectWriters(result);
customCodec().addObjectWritersTo(result);
// String + "*/*"
defaultCodec().addStringWriterTo(result);
return result;
}
@ -181,13 +165,6 @@ public abstract class AbstractCodecConfigurer { @@ -181,13 +165,6 @@ public abstract class AbstractCodecConfigurer {
defaultCodec().addStringWriterTextPlainOnlyTo(result);
}
/**
* Add custom, concrete, Java type readers.
*/
protected void addCustomTypedWriter(List<HttpMessageWriter<?>> result) {
customCodec().addTypedWritersTo(result);
}
/**
* Add built-in, Object-based readers.
*/
@ -200,14 +177,6 @@ public abstract class AbstractCodecConfigurer { @@ -200,14 +177,6 @@ public abstract class AbstractCodecConfigurer {
}
}
/**
* Add custom, Object-based readers.
*/
protected void addCustomObjectWriters(List<HttpMessageWriter<?>> result) {
customCodec().addObjectWritersTo(result);
}
/**
* A registry and a factory for built-in HTTP message readers and writers.

9
spring-web/src/main/java/org/springframework/http/codec/ClientCodecConfigurer.java

@ -21,6 +21,15 @@ import org.springframework.core.codec.Decoder; @@ -21,6 +21,15 @@ import org.springframework.core.codec.Decoder;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
/**
* Helps to configure a list of client-side HTTP message readers and writers
* with support for built-in defaults and options to register additional custom
* readers and writers via {@link #customCodec()}.
*
* <p>The built-in defaults include basic data types such as various byte
* representations, resources, strings, forms, but also others like JAXB2 and
* Jackson 2 based on classpath detection. There are options to
* {@link #defaultCodec() override} some of the defaults or to have them
* {@link #registerDefaults(boolean) turned off} completely.
*
* @author Rossen Stoyanchev
* @since 5.0

Loading…
Cancel
Save