/** * Set the {@code ObjectMapper} for this view. * If not set, a default {@link ObjectMapper#ObjectMapper() ObjectMapper} will be used. * <p>Setting a custom-configured {@code ObjectMapper} is one way to take further control of * the JSON serialization process. The other option is to use Jackson's provided annotations * on the types to be serialized, in which case a custom-configured ObjectMapper is unnecessary. */ public void setObjectMapper(ObjectMapper objectMapper) { this.objectMapper = objectMapper; configurePrettyPrint(); }
/** * Whether to use the default pretty printer when writing the output. * This is a shortcut for setting up an {@code ObjectMapper} as follows: * <pre class="code"> * ObjectMapper mapper = new ObjectMapper(); * mapper.configure(SerializationFeature.INDENT_OUTPUT, true); * </pre> * <p>The default value is {@code false}. */ public void setPrettyPrint(boolean prettyPrint) { this.prettyPrint = prettyPrint; configurePrettyPrint(); }
/** * Set the {@code ObjectMapper} for this view. * If not set, a default {@link ObjectMapper#ObjectMapper() ObjectMapper} will be used. * <p>Setting a custom-configured {@code ObjectMapper} is one way to take further control of * the JSON serialization process. The other option is to use Jackson's provided annotations * on the types to be serialized, in which case a custom-configured ObjectMapper is unnecessary. */ public void setObjectMapper(ObjectMapper objectMapper) { this.objectMapper = objectMapper; configurePrettyPrint(); }
/** * Whether to use the default pretty printer when writing the output. * This is a shortcut for setting up an {@code ObjectMapper} as follows: * <pre class="code"> * ObjectMapper mapper = new ObjectMapper(); * mapper.configure(SerializationFeature.INDENT_OUTPUT, true); * </pre> * <p>The default value is {@code false}. */ public void setPrettyPrint(boolean prettyPrint) { this.prettyPrint = prettyPrint; configurePrettyPrint(); }
protected AbstractJackson2View(ObjectMapper objectMapper, String contentType) { this.objectMapper = objectMapper; configurePrettyPrint(); setContentType(contentType); setExposePathVariables(false); }
protected AbstractJackson2View(ObjectMapper objectMapper, String contentType) { this.objectMapper = objectMapper; configurePrettyPrint(); setContentType(contentType); setExposePathVariables(false); }
/** * Whether to use the default pretty printer when writing the output. * This is a shortcut for setting up an {@code ObjectMapper} as follows: * <pre class="code"> * ObjectMapper mapper = new ObjectMapper(); * mapper.configure(SerializationFeature.INDENT_OUTPUT, true); * </pre> * <p>The default value is {@code false}. */ public void setPrettyPrint(boolean prettyPrint) { this.prettyPrint = prettyPrint; configurePrettyPrint(); }
/** * Set the {@code ObjectMapper} for this view. * If not set, a default {@link ObjectMapper#ObjectMapper() ObjectMapper} will be used. * <p>Setting a custom-configured {@code ObjectMapper} is one way to take further control of * the JSON serialization process. The other option is to use Jackson's provided annotations * on the types to be serialized, in which case a custom-configured ObjectMapper is unnecessary. */ public void setObjectMapper(ObjectMapper objectMapper) { Assert.notNull(objectMapper, "'objectMapper' must not be null"); this.objectMapper = objectMapper; configurePrettyPrint(); }