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.6 and higher, as of Spring 4.3.
MappingJackson2JsonView
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_CONTENT_TYPE
The default content type for the view.
|
updateContentLength
logger
PATH_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 java.lang.Object |
filterModel(java.util.Map<java.lang.String,java.lang.Object> model)
Filter out undesired attributes from the given model.
|
void |
setModelKey(java.lang.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, writeSuffix
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, toString, writeToResponse
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
public static final java.lang.String DEFAULT_CONTENT_TYPE
public MappingJackson2XmlView()
MappingJackson2XmlView
using default configuration
provided by Jackson2ObjectMapperBuilder
and setting the content type
to application/xml
.public void setModelKey(java.lang.String modelKey)
AbstractJackson2View
setModelKey
in class AbstractJackson2View
protected java.lang.Object filterModel(java.util.Map<java.lang.String,java.lang.Object> model)
AbstractJackson2View
Map
or a single value object.filterModel
in class AbstractJackson2View
model
- 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)