net.sf.json.spring.web.servlet.view
Class JsonView

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 net.sf.json.spring.web.servlet.view.JsonView
All Implemented Interfaces:
org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.View

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

A View that renders its model as a JSON object.

Author:
Andres Almiray

Field Summary
 
Fields inherited from class org.springframework.web.servlet.view.AbstractView
DEFAULT_CONTENT_TYPE
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
JsonView()
           
 
Method Summary
protected  net.sf.json.JSON createJSON(java.util.Map model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Creates a JSON [JSONObject,JSONArray,JSONNUll] from the model values.
protected  net.sf.json.JSON defaultCreateJSON(java.util.Map model)
          Creates a JSON [JSONObject,JSONArray,JSONNUll] from the model values.
protected  java.lang.String[] getExcludedProperties()
          Returns the group of properties to be excluded.
 net.sf.json.JsonConfig getJsonConfig()
           
 boolean isForceTopLevelArray()
           
 boolean isIgnoreDefaultExcludes()
          Returns whether the JSONSerializer will ignore or not its internal property exclusions.
 boolean isSkipBindingResult()
          Returns whether the JSONSerializer will skip or not any BindingResult related keys on the model.
protected  void renderMergedOutputModel(java.util.Map model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void setExcludedProperties(java.lang.String[] excludedProperties)
          Sets the group of properties to be excluded.
 void setForceTopLevelArray(boolean forceTopLevelArray)
           
 void setIgnoreDefaultExcludes(boolean ignoreDefaultExcludes)
          Sets whether the JSONSerializer will ignore or not its internal property exclusions.
 void setJsonConfig(net.sf.json.JsonConfig jsonConfig)
           
 void setSkipBindingResult(boolean skipBindingResult)
          Sets whether the JSONSerializer will skip or not any BindingResult related keys on the model.
protected  void writeJSON(java.util.Map model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createRequestContext, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute, toString
 
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
 

Constructor Detail

JsonView

public JsonView()
Method Detail

getJsonConfig

public net.sf.json.JsonConfig getJsonConfig()

isForceTopLevelArray

public boolean isForceTopLevelArray()

isIgnoreDefaultExcludes

public boolean isIgnoreDefaultExcludes()
Returns whether the JSONSerializer will ignore or not its internal property exclusions.


isSkipBindingResult

public boolean isSkipBindingResult()
Returns whether the JSONSerializer will skip or not any BindingResult related keys on the model.

Models in Spring >= 2.5 will cause an exception as they contain a BindingResult that cycles back.


setExcludedProperties

public void setExcludedProperties(java.lang.String[] excludedProperties)
Sets the group of properties to be excluded.


setForceTopLevelArray

public void setForceTopLevelArray(boolean forceTopLevelArray)

setIgnoreDefaultExcludes

public void setIgnoreDefaultExcludes(boolean ignoreDefaultExcludes)
Sets whether the JSONSerializer will ignore or not its internal property exclusions.


setJsonConfig

public void setJsonConfig(net.sf.json.JsonConfig jsonConfig)

setSkipBindingResult

public void setSkipBindingResult(boolean skipBindingResult)
Sets whether the JSONSerializer will skip or not any BindingResult related keys on the model.

Models in Spring >= 2.5 will cause an exception as they contain a BindingResult that cycles back.


createJSON

protected net.sf.json.JSON createJSON(java.util.Map model,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
Creates a JSON [JSONObject,JSONArray,JSONNUll] from the model values.


defaultCreateJSON

protected final net.sf.json.JSON defaultCreateJSON(java.util.Map model)
Creates a JSON [JSONObject,JSONArray,JSONNUll] from the model values.


getExcludedProperties

protected java.lang.String[] getExcludedProperties()
Returns the group of properties to be excluded.


renderMergedOutputModel

protected void renderMergedOutputModel(java.util.Map model,
                                       javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
                                throws java.lang.Exception
Specified by:
renderMergedOutputModel in class org.springframework.web.servlet.view.AbstractView
Throws:
java.lang.Exception

writeJSON

protected void writeJSON(java.util.Map model,
                         javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
                  throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2006-2008 Json-lib. All Rights Reserved.