open class MappingJackson2HttpMessageConverter : AbstractJackson2HttpMessageConverter
Implementation of org.springframework.http.converter.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.
Compatible with Jackson 2.9 and higher, as of Spring 5.0.
Author
Arjen Poutsma
Author
Keith Donald
Author
Rossen Stoyanchev
Author
Juergen Hoeller
Author
Sebastien Deleuze
Since
3.1.2
MappingJackson2HttpMessageConverter()
Construct a new MappingJackson2HttpMessageConverter using default configuration provided by Jackson2ObjectMapperBuilder. MappingJackson2HttpMessageConverter(objectMapper: ObjectMapper)
Construct a new MappingJackson2HttpMessageConverter with a custom ObjectMapper. You can use Jackson2ObjectMapperBuilder to build it easily. |
static val DEFAULT_CHARSET: Charset |
open fun setJsonPrefix(jsonPrefix: String): Unit
Specify a custom prefix to use for this view's JSON output. Default is none. |
|
open fun setPrefixJson(prefixJson: Boolean): Unit
Indicate whether the JSON output by this view should be prefixed with ")]}', ". Default is false. 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. |
open fun canRead(clazz: Class<*>, mediaType: MediaType): Booleanopen fun canRead(type: Type, contextClass: Class<*>, mediaType: MediaType): Boolean |
|
open fun canWrite(clazz: Class<*>, mediaType: MediaType): Boolean |
|
open fun getObjectMapper(): ObjectMapper
Return the underlying |
|
open fun read(type: Type, contextClass: Class<*>, inputMessage: HttpInputMessage): Any |
|
open fun setObjectMapper(objectMapper: ObjectMapper): Unit
Set the Setting a custom-configured |
|
open fun setPrettyPrint(prettyPrint: Boolean): Unit
Whether to use the DefaultPrettyPrinter when writing JSON. This is a shortcut for setting up an
|