类 MappingJackson2XmlView
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.context.support.WebApplicationObjectSupport
- org.springframework.web.servlet.view.AbstractView
- org.springframework.web.servlet.view.json.AbstractJackson2View
- org.springframework.web.servlet.view.xml.MappingJackson2XmlView
- 所有已实现的接口:
Aware
,BeanNameAware
,ApplicationContextAware
,ServletContextAware
,View
public class MappingJackson2XmlView extends AbstractJackson2View
Spring MVCView
that renders XML content by serializing the model for the current request using Jackson 2'sXmlMapper
.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.
- 从以下版本开始:
- 4.1
- 作者:
- Sebastien Deleuze
- 另请参阅:
MappingJackson2JsonView
字段概要
字段 修饰符和类型 字段 说明 static String
DEFAULT_CONTENT_TYPE
The default content type for the view.从类继承的字段 org.springframework.web.servlet.view.json.AbstractJackson2View
updateContentLength
从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
从接口继承的字段 org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
构造器概要
构造器 构造器 说明 MappingJackson2XmlView()
Construct a newMappingJackson2XmlView
using default configuration provided byJackson2ObjectMapperBuilder
and setting the content type toapplication/xml
.MappingJackson2XmlView(XmlMapper xmlMapper)
Construct a newMappingJackson2XmlView
using the providedXmlMapper
and setting the content type toapplication/xml
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.web.servlet.view.json.AbstractJackson2View
filterAndWrapModel, getEncoding, getObjectMapper, prepareResponse, renderMergedOutputModel, setDisableCaching, setEncoding, setObjectMapper, setPrettyPrint, setUpdateContentLength, writeContent, writePrefix, writeSuffix
从类继承的方法 org.springframework.web.servlet.view.AbstractView
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
从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
字段详细资料
DEFAULT_CONTENT_TYPE
public static final String DEFAULT_CONTENT_TYPE
The default content type for the view.- 另请参阅:
- 常量字段值
构造器详细资料
MappingJackson2XmlView
public MappingJackson2XmlView()
Construct a newMappingJackson2XmlView
using default configuration provided byJackson2ObjectMapperBuilder
and setting the content type toapplication/xml
.
MappingJackson2XmlView
public MappingJackson2XmlView(XmlMapper xmlMapper)
Construct a newMappingJackson2XmlView
using the providedXmlMapper
and setting the content type toapplication/xml
.- 从以下版本开始:
- 4.2.1
方法详细资料
setModelKey
public void setModelKey(String modelKey)
从类复制的说明:AbstractJackson2View
Set the attribute in the model that should be rendered by this view. When set, all other model attributes will be ignored.- 指定者:
setModelKey
在类中AbstractJackson2View
filterModel
protected Object filterModel(Map<String,Object> model)
从类复制的说明:AbstractJackson2View
Filter out undesired attributes from the given model. The return value can be either anotherMap
or a single value object.- 指定者:
filterModel
在类中AbstractJackson2View
- 参数:
model
- the model, as passed on toAbstractJackson2View.renderMergedOutputModel(java.util.Map<java.lang.String, java.lang.Object>, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- 返回:
- the value to be rendered