Spring BlazeDS Integration

org.springframework.flex.http
Class AmfView

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.view.AbstractView
              extended by org.springframework.flex.http.AmfView
All Implemented Interfaces:
BeanNameAware, ApplicationContextAware, ServletContextAware, View

public class AmfView
extends AbstractView

Spring-MVC View that renders AMF content by serializing the model for the current request using BlazeDS's AMF serialization/deserialization APIs.

By default, the entire contents of the model map (with the exception of framework-specific classes) will be encoded as AMF. For cases where the contents of the map need to be filtered, users may specify a specific set of model attributes to encode via the renderedAttributes property.

Author:
Jeremy Grelle

Field Summary
static String DEFAULT_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
AmfView()
           
 
Method Summary
protected  Object filterModel(Map<String,Object> model)
          Filters out undesired attributes from the given model.
 Set<String> getRenderedAttributes()
          Returns the attributes in the model that should be rendered by this view.
protected  void prepareResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          
protected  void renderMergedOutputModel(Map<String,Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          
 void setDisableCaching(boolean disableCaching)
          Disables caching of the generated AMF response.
 void setRenderedAttributes(Set<String> renderedAttributes)
          Sets the attributes in the model that should be rendered by this view.
 
Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, 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, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CONTENT_TYPE

public static final String DEFAULT_CONTENT_TYPE
See Also:
Constant Field Values
Constructor Detail

AmfView

public AmfView()
Method Detail

getRenderedAttributes

public Set<String> getRenderedAttributes()
Returns the attributes in the model that should be rendered by this view.


setRenderedAttributes

public void setRenderedAttributes(Set<String> renderedAttributes)
Sets the attributes in the model that should be rendered by this view. When set, all other model attributes will be ignored.


setDisableCaching

public void setDisableCaching(boolean disableCaching)
Disables caching of the generated AMF response.

Default is true, which will prevent the client from caching the generated AMF response.


prepareResponse

protected void prepareResponse(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)

Overrides:
prepareResponse in class AbstractView

renderMergedOutputModel

protected void renderMergedOutputModel(Map<String,Object> model,
                                       javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                                throws Exception

Specified by:
renderMergedOutputModel in class AbstractView
Throws:
Exception

filterModel

protected Object filterModel(Map<String,Object> model)
Filters out undesired attributes from the given model. The return value can be either another Map, or a single value object. If only a single attribute is present in the model map, that value will be returned instead of the full map.

Default implementation removes BindingResult instances and entries not included in the renderedAttributes property.

Parameters:
model - the model, as passed on to renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
Returns:
the object to be rendered

Spring BlazeDS Integration

Copyright © 2011. All Rights Reserved.