org.jasig.portlet.newsreader.mvc
Class EmptyView

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.jasig.portlet.newsreader.mvc.EmptyView
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.View

public class EmptyView
extends org.springframework.web.servlet.view.AbstractView


Field Summary
static String DEFAULT_CONTENT_TYPE
          Default content type.
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Fields inherited from interface org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE
 
Constructor Summary
EmptyView()
           
 
Method Summary
protected  Object filterModel(Map<String,Object> model)
          Filters out undesired attributes from the given model.
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 setEncoding(org.codehaus.jackson.JsonEncoding encoding)
          Sets the JsonEncoding for this converter.
 void setObjectMapper(org.codehaus.jackson.map.ObjectMapper objectMapper)
          Sets the ObjectMapper for this view.
 void setPrefixJson(boolean prefixJson)
          Indicates whether the JSON output by this view should be prefixed with "{} &&".
 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, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, isExposePathVariables, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposePathVariables, 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
Default content type. Overridable as bean property.

See Also:
Constant Field Values
Constructor Detail

EmptyView

public EmptyView()
Method Detail

setObjectMapper

public void setObjectMapper(org.codehaus.jackson.map.ObjectMapper objectMapper)
Sets the ObjectMapper for this view. If not set, a default ObjectMapper is used.

Setting a custom-configured ObjectMapper is one way to take further control of the JSON serialization process. For example, an extended SerializerFactory can be configured that provides custom serializers for specific types. The other option for refining the serialization process is to use Jackson's provided annotations on the types to be serialized, in which case a custom-configured ObjectMapper is unnecessary.


setEncoding

public void setEncoding(org.codehaus.jackson.JsonEncoding encoding)
Sets the JsonEncoding for this converter. By default, UTF-8 is used.


setPrefixJson

public void setPrefixJson(boolean prefixJson)
Indicates whether the JSON output by this view should be prefixed with "{} &&". Default is false.

Prefixing the JSON string in this manner is used to help prevent JSON Hijacking. The prefix renders the string syntactically invalid as a script so that it cannot be hijacked. This prefix does not affect the evaluation of JSON, but if JSON validation is performed on the string, the prefix would need to be ignored.


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.


prepareResponse

protected void prepareResponse(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
Overrides:
prepareResponse in class org.springframework.web.servlet.view.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 org.springframework.web.servlet.view.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.

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


Copyright © 2009-2013 Jasig. All Rights Reserved.