Class JacksonXmlView
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.AbstractJacksonView
org.springframework.web.servlet.view.xml.JacksonXmlView
- All Implemented Interfaces:
- Aware, BeanNameAware, ApplicationContextAware, ServletContextAware, View
Spring MVC 
View that renders XML content by serializing the model for the current request
using Jackson 3's XmlMapper.
The Object to be serialized is supplied as a parameter in the model. The first serializable
entry is used. Users can specify a specific entry in the model via the
sourceKey property.
The following special model entries are supported:
- A JSON view with a com.fasterxml.jackson.annotation.JsonViewkey and the class name of the JSON view as value.
- A filter provider with a tools.jackson.databind.ser.FilterProviderkey and the filter provider class name as value.
- Since:
- 7.0
- Author:
- Sebastien Deleuze
- See Also:
- 
Field SummaryFieldsFields inherited from class AbstractJacksonViewFILTER_PROVIDER_HINT, JSON_VIEW_HINT, updateContentLengthFields inherited from class ApplicationObjectSupportloggerFields inherited from interface ViewPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct a new instance with anXmlMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader)and setting the content type toapplication/xml.JacksonXmlView(tools.jackson.dataformat.xml.XmlMapper mapper) Construct a new instance using the providedXmlMapperand setting the content type toapplication/xml.JacksonXmlView(tools.jackson.dataformat.xml.XmlMapper.Builder builder) Construct a new instance using the providedXmlMapper.Buildercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader)and setting the content type toapplication/xml.
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectfilterModel(Map<String, Object> model, jakarta.servlet.http.HttpServletRequest request) Filter out undesired attributes from the given model.voidsetModelKey(String modelKey) Set the attribute in the model that should be rendered by this view.Methods inherited from class AbstractJacksonViewgetEncoding, prepareResponse, renderMergedOutputModel, setDisableCaching, setEncoding, setUpdateContentLength, writeContent, writePrefix, writeSuffixMethods inherited from class AbstractViewaddStaticAttribute, 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, writeToResponseMethods inherited from class WebApplicationObjectSupportgetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextMethods inherited from class ApplicationObjectSupportgetApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
- 
Field Details- 
DEFAULT_CONTENT_TYPEDefault content type: "application/xml".Overridable through AbstractView.setContentType(String).- See Also:
 
 
- 
- 
Constructor Details- 
JacksonXmlViewpublic JacksonXmlView()Construct a new instance with anXmlMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader)and setting the content type toapplication/xml.
- 
JacksonXmlViewpublic JacksonXmlView(tools.jackson.dataformat.xml.XmlMapper.Builder builder) Construct a new instance using the providedXmlMapper.Buildercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader)and setting the content type toapplication/xml.- See Also:
 
- 
JacksonXmlViewpublic JacksonXmlView(tools.jackson.dataformat.xml.XmlMapper mapper) Construct a new instance using the providedXmlMapperand setting the content type toapplication/xml.- See Also:
 
 
- 
- 
Method Details- 
setModelKeyDescription copied from class:AbstractJacksonViewSet the attribute in the model that should be rendered by this view.When set, all other model attributes will be ignored. - Specified by:
- setModelKeyin class- AbstractJacksonView
 
- 
filterModelprotected Object filterModel(Map<String, Object> model, jakarta.servlet.http.HttpServletRequest request) Description copied from class:AbstractJacksonViewFilter out undesired attributes from the given model.The return value can be either another Mapor a single value object.- Specified by:
- filterModelin class- AbstractJacksonView
- Parameters:
- model- the model, as passed on to- AbstractJacksonView.renderMergedOutputModel(Map, HttpServletRequest, HttpServletResponse)
- request- current HTTP request
- Returns:
- the value to be rendered
 
 
-