public class MappingJackson2XmlView extends AbstractJackson2View
View that renders XML content by serializing the model for the current request
using Jackson 2's XmlMapper.
The Object to be serialized is supplied as a parameter in the model. The first serializable
entry is used. Users can either specify a specific entry in the model via the
sourceKey property.
The default constructor uses the default configuration provided by Jackson2ObjectMapperBuilder.
Compatible with Jackson 2.9 to 2.12, as of Spring 5.3.
MappingJackson2JsonView| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CONTENT_TYPE
The default content type for the view.
|
updateContentLengthloggerPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE| Constructor and Description |
|---|
MappingJackson2XmlView()
Construct a new
MappingJackson2XmlView using default configuration
provided by Jackson2ObjectMapperBuilder and setting the content type
to application/xml. |
MappingJackson2XmlView(XmlMapper xmlMapper)
Construct a new
MappingJackson2XmlView using the provided XmlMapper
and setting the content type to application/xml. |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
filterModel(Map<String,Object> model)
Filter out undesired attributes from the given model.
|
void |
setModelKey(String modelKey)
Set the attribute in the model that should be rendered by this view.
|
filterAndWrapModel, getEncoding, getObjectMapper, prepareResponse, renderMergedOutputModel, setDisableCaching, setEncoding, setObjectMapper, setPrettyPrint, setUpdateContentLength, writeContent, writePrefix, writeSuffixaddStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, toString, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContextpublic static final String DEFAULT_CONTENT_TYPE
public MappingJackson2XmlView()
MappingJackson2XmlView using default configuration
provided by Jackson2ObjectMapperBuilder and setting the content type
to application/xml.public void setModelKey(String modelKey)
AbstractJackson2ViewsetModelKey in class AbstractJackson2Viewprotected Object filterModel(Map<String,Object> model)
AbstractJackson2ViewMap or a single value object.filterModel in class AbstractJackson2Viewmodel - the model, as passed on to AbstractJackson2View.renderMergedOutputModel(java.util.Map<java.lang.String, java.lang.Object>, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)