- Javadoc
- Renamed JacksonHttpMessageConverter to BindingJacksonHttpMessageConverter
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.http.converter.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.JsonEncoding;
|
||||
import org.codehaus.jackson.JsonFactory;
|
||||
@@ -34,10 +35,19 @@ import org.springframework.http.converter.HttpMessageNotWritableException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter} that can read
|
||||
* and write JSON using <a href="http://jackson.codehaus.org/">Jackson's</a> {@link ObjectMapper}.
|
||||
*
|
||||
* <p>This converter can be used to bind to typed beans, or untyped {@link java.util.HashMap HashMap} instances.
|
||||
*
|
||||
* <p>By default, this converter supports {@code application/json}. This can be overridden by setting the {@link
|
||||
* #setSupportedMediaTypes(List) supportedMediaTypes} property, and overriding the {@link #getContentType(Object)}
|
||||
* method.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JacksonHttpMessageConverter<T> extends AbstractHttpMessageConverter<T> {
|
||||
public class BindingJacksonHttpMessageConverter<T> extends AbstractHttpMessageConverter<T> {
|
||||
|
||||
private ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@@ -45,20 +55,31 @@ public class JacksonHttpMessageConverter<T> extends AbstractHttpMessageConverter
|
||||
|
||||
private JsonEncoding encoding = JsonEncoding.UTF8;
|
||||
|
||||
public JacksonHttpMessageConverter() {
|
||||
/**
|
||||
* Construct a new {@code BindingJacksonHttpMessageConverter},
|
||||
*/
|
||||
public BindingJacksonHttpMessageConverter() {
|
||||
super(new MediaType("application", "json"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@code ObjectMapper} for this converter. By default, a default {@link ObjectMapper#ObjectMapper()
|
||||
* ObjectMapper} is used.
|
||||
*/
|
||||
public void setObjectMapper(ObjectMapper objectMapper) {
|
||||
Assert.notNull(objectMapper, "'objectMapper' must not be null");
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
/** Sets the {@code JsonFactory} for this converter. By default, a {@link MappingJsonFactory} is used. */
|
||||
public void setJsonFactory(JsonFactory jsonFactory) {
|
||||
Assert.notNull(jsonFactory, "'jsonFactory' must not be null");
|
||||
this.jsonFactory = jsonFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@code JsonEncoding} for this converter. By default, {@linkplain JsonEncoding#UTF8 UTF-8} is used.
|
||||
*/
|
||||
public void setEncoding(JsonEncoding encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
@@ -44,7 +44,6 @@ import org.springframework.util.Assert;
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
*/
|
||||
|
||||
public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConverter<Object>
|
||||
implements InitializingBean {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user