org.springframework.oxm.support
Class MarshallingView
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.AbstractUrlBasedView
org.springframework.oxm.support.MarshallingView
- All Implemented Interfaces:
- BeanNameAware, InitializingBean, ApplicationContextAware, ServletContextAware, View
public class MarshallingView
- extends AbstractUrlBasedView
Spring-MVC View
that allows for response context to be rendered as the result of marshalling by a Marshaller
.
The Object to be marshalled is supplied as a parameter in the model and then detected during response rendering. Users can either specify a specific entry in the model via the sourceKey
property or have Spring locate the Source object.
- Since:
- 1.5.1
- Author:
- Arjen Poutsma
Methods inherited from class org.springframework.web.servlet.view.AbstractView |
addStaticAttribute, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute, writeToResponse |
DEFAULT_CONTENT_TYPE
public static final String DEFAULT_CONTENT_TYPE
- Default content type. Overridable as bean property.
- See Also:
- Constant Field Values
MarshallingView
public MarshallingView()
- Constructs a new
MarshallingView
with no Marshaller
set. The marshaller must be set after
construction by invoking setMarshaller(Marshaller)
.
MarshallingView
public MarshallingView(Marshaller marshaller)
- Constructs a new
MarshallingView
with the given Marshaller
set.
setMarshaller
public void setMarshaller(Marshaller marshaller)
- Sets the
Marshaller
to be used by this view.
setModelKey
public void setModelKey(String modelKey)
- Set the name of the model key that represents the object to be marshalled. If not specified, the model map will
be searched for a supported value type.
- See Also:
Marshaller.supports(Class)
initApplicationContext
protected void initApplicationContext()
throws BeansException
- Overrides:
initApplicationContext
in class ApplicationObjectSupport
- Throws:
BeansException
renderMergedOutputModel
protected void renderMergedOutputModel(Map model,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
- Specified by:
renderMergedOutputModel
in class AbstractView
- Throws:
Exception
locateToBeMarshalled
protected Object locateToBeMarshalled(Map model)
throws ServletException
- Locates the object to be marshalled. The default implementation first attempts to look under the configured
model key, if any, before attempting to locate an object of supported type.
- Parameters:
model
- the model Map
- Returns:
- the Object to be marshalled (or
null
if none found)
- Throws:
ServletException
- if the model object specified by the model key is not
supported by the marshaller- See Also:
setModelKey(String)
Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.