public void setObjectMapper(ObjectMapper objectMapper)
Set the ObjectMapper for this view.
If not set, a default ObjectMapper will be used.
Setting a custom-configured 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.
Whether to use the default pretty printer when writing the output.
This is a shortcut for setting up an ObjectMapper as follows:
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
The default value is false.
setDisableCaching
public void setDisableCaching(boolean disableCaching)
Disables caching of the generated JSON.
Default is true, which will prevent the client from caching the generated JSON.
setUpdateContentLength
public void setUpdateContentLength(boolean updateContentLength)
Whether to update the 'Content-Length' header of the response. When set to
true, the response is buffered in order to determine the content
length and set the 'Content-Length' header of the response.
Subclasses must implement this method to actually render the view.
The first step will be preparing the request: In the JSP case,
this would mean setting model objects as request attributes.
The second step will be the actual rendering of the view,
for example including the JSP via a RequestDispatcher.