Class 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.
since 7.0 in favor of JacksonJsonHttpMessageConverter
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
  • Constructor Details

  • Method Details

    • setJsonPrefix

      public 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. 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 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.

      See Also:
    • getMediaTypesForProblemDetail

      protected List<MediaType> 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) for ProblemDetail. By default, an empty list, unless overridden in subclasses.
      Overrides:
      getMediaTypesForProblemDetail in class AbstractJackson2HttpMessageConverter
    • 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 class AbstractJackson2HttpMessageConverter
      Parameters:
      generator - the generator to use for writing content.
      object - the object to write to the output message.
      Throws:
      IOException