| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractView
org.springframework.web.servlet.view.xml.MarshallingView
public class MarshallingView
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.
| Field Summary | |
|---|---|
| static String | DEFAULT_CONTENT_TYPEDefault content type. | 
| Fields inherited from class org.springframework.context.support.ApplicationObjectSupport | 
|---|
| logger | 
| Fields inherited from interface org.springframework.web.servlet.View | 
|---|
| RESPONSE_STATUS_ATTRIBUTE | 
| Constructor Summary | |
|---|---|
| MarshallingView()Constructs a new MarshallingViewwith noMarshallerset. | |
| MarshallingView(Marshaller marshaller)Constructs a new MarshallingViewwith the givenMarshallerset. | |
| Method Summary | |
|---|---|
| protected  void | initApplicationContext()Subclasses can override this for custom initialization behavior. | 
| protected  Object | locateToBeMarshalled(Map model)Locates the object to be marshalled. | 
| protected  void | renderMergedOutputModel(Map model,
                        HttpServletRequest request,
                        HttpServletResponse response)Subclasses must implement this method to actually render the view. | 
|  void | setMarshaller(Marshaller marshaller)Sets the Marshallerto be used by this view. | 
|  void | setModelKey(String modelKey)Set the name of the model key that represents the object to be marshalled. | 
| 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, toString, writeToResponse | 
| Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport | 
|---|
| getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext | 
| Methods inherited from class org.springframework.context.support.ApplicationObjectSupport | 
|---|
| getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final String DEFAULT_CONTENT_TYPE
| Constructor Detail | 
|---|
public MarshallingView()
MarshallingView with no Marshaller set. The marshaller must be set after
 construction by invoking setMarshaller(Marshaller).
public MarshallingView(Marshaller marshaller)
MarshallingView with the given Marshaller set.
| Method Detail | 
|---|
public void setMarshaller(Marshaller marshaller)
Marshaller to be used by this view.
public void setModelKey(String modelKey)
Marshaller.supports(Class)
protected void initApplicationContext()
                               throws BeansException
ApplicationObjectSupportThe default implementation is empty. Called by
 ApplicationObjectSupport.initApplicationContext(org.springframework.context.ApplicationContext).
initApplicationContext in class ApplicationObjectSupportApplicationContextException - in case of initialization errors
BeansException - if thrown by ApplicationContext methodsApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext)
protected void renderMergedOutputModel(Map model,
                                       HttpServletRequest request,
                                       HttpServletResponse response)
                                throws Exception
AbstractViewThe first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.
renderMergedOutputModel in class AbstractViewmodel - combined output Map (never null),
 with dynamic values taking precedence over static attributesrequest - current HTTP requestresponse - current HTTP response
Exception - if rendering failed
protected Object locateToBeMarshalled(Map model)
                               throws ServletException
model - the model Map
null if none found)
ServletException - if the model object specified by the model key is not
                          supported by the marshallersetModelKey(String)| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||