Class MappingJackson2HttpMessageConverter
java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<Object>
org.springframework.http.converter.AbstractGenericHttpMessageConverter<Object>
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
- All Implemented Interfaces:
GenericHttpMessageConverter<Object>, HttpMessageConverter<Object>
@Deprecated(since="7.0",
forRemoval=true)
public class MappingJackson2HttpMessageConverter
extends AbstractJackson2HttpMessageConverter
Deprecated, for removal: This API element is subject to removal in a future version.
Implementation of
HttpMessageConverter
that can read and
write JSON using Jackson 2.x's ObjectMapper
.
This converter can be used to bind to typed beans, or untyped HashMap
instances.
By default, this converter supports application/json
and application/*+json
with UTF-8
character set. This can be overridden by setting the
supportedMediaTypes
property.
The default constructor uses the default configuration provided by Jackson2ObjectMapperBuilder
.
- Since:
- 3.1.2
- Author:
- Arjen Poutsma, Keith Donald, Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze
-
Field Summary
Fields inherited from class AbstractJackson2HttpMessageConverter
defaultObjectMapper
Fields inherited from class AbstractHttpMessageConverter
logger
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Construct a newMappingJackson2HttpMessageConverter
using default configuration provided byJackson2ObjectMapperBuilder
.MappingJackson2HttpMessageConverter
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Deprecated, for removal: This API element is subject to removal in a future version.Construct a newMappingJackson2HttpMessageConverter
with a customObjectMapper
. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Return the supported media type(s) forProblemDetail
.void
setJsonPrefix
(String jsonPrefix) Deprecated, for removal: This API element is subject to removal in a future version.Specify a custom prefix to use for this view's JSON output.void
setPrefixJson
(boolean prefixJson) Deprecated, for removal: This API element is subject to removal in a future version.Indicate whether the JSON output by this view should be prefixed with ")]}', ".protected void
writePrefix
(com.fasterxml.jackson.core.JsonGenerator generator, Object object) Deprecated, for removal: This API element is subject to removal in a future version.Write a prefix before the main content.Methods inherited from class AbstractJackson2HttpMessageConverter
canRead, canRead, canWrite, customizeReader, customizeWriter, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getObjectMapper, getObjectMappersForType, getSupportedMediaTypes, logWarningIfNecessary, read, readInternal, registerObjectMappersForType, setObjectMapper, setPrettyPrint, setSupportedMediaTypes, supportsRepeatableWrites, writeInternal, writeSuffix
Methods inherited from class AbstractGenericHttpMessageConverter
canWrite, supports, write, writeInternal
Methods inherited from class AbstractHttpMessageConverter
addDefaultHeaders, canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, write
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface HttpMessageConverter
getSupportedMediaTypes, read, write
-
Constructor Details
-
MappingJackson2HttpMessageConverter
public MappingJackson2HttpMessageConverter()Deprecated, for removal: This API element is subject to removal in a future version.Construct a newMappingJackson2HttpMessageConverter
using default configuration provided byJackson2ObjectMapperBuilder
. -
MappingJackson2HttpMessageConverter
public MappingJackson2HttpMessageConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Deprecated, for removal: This API element is subject to removal in a future version.Construct a newMappingJackson2HttpMessageConverter
with a customObjectMapper
. You can useJackson2ObjectMapperBuilder
to build it easily.- See Also:
-
-
Method Details
-
setJsonPrefix
Deprecated, for removal: This API element is subject to removal in a future version.Specify a custom prefix to use for this view's JSON output. Default is none.- See Also:
-
setPrefixJson
public void setPrefixJson(boolean prefixJson) Deprecated, for removal: This API element is subject to removal in a future version.Indicate whether the JSON output by this view should be prefixed with ")]}', ". Default isfalse
.Prefixing the JSON string in this manner is used to help prevent JSON Hijacking. The prefix renders the string syntactically invalid as a script so that it cannot be hijacked. This prefix should be stripped before parsing the string as JSON.
- See Also:
-
getMediaTypesForProblemDetail
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractJackson2HttpMessageConverter
Return the supported media type(s) forProblemDetail
. By default, an empty list, unless overridden in subclasses.- Overrides:
getMediaTypesForProblemDetail
in classAbstractJackson2HttpMessageConverter
-
writePrefix
protected void writePrefix(com.fasterxml.jackson.core.JsonGenerator generator, Object object) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from class:AbstractJackson2HttpMessageConverter
Write a prefix before the main content.- Overrides:
writePrefix
in classAbstractJackson2HttpMessageConverter
- Parameters:
generator
- the generator to use for writing content.object
- the object to write to the output message.- Throws:
IOException
-
JacksonJsonHttpMessageConverter