public class FastJsonJsonView
extends org.springframework.web.servlet.view.AbstractView
AbstractView| Modifier and Type | Field and Description |
|---|---|
private static java.util.regex.Pattern |
CALLBACK_PARAM_PATTERN
Pattern for validating jsonp callback parameter values.
|
protected java.nio.charset.Charset |
charset
Deprecated.
|
protected java.lang.String |
dateFormat
Deprecated.
|
static java.lang.String |
DEFAULT_CONTENT_TYPE
default content type
|
static java.lang.String |
DEFAULT_JSONP_CONTENT_TYPE
Default content type for JSONP: "application/javascript".
|
private boolean |
disableCaching
disableCaching
|
private boolean |
extractValueFromSingleKeyModel
extractValueFromSingleKeyModel
|
private FastJsonConfig |
fastJsonConfig
with fastJson config
|
protected SerializerFeature[] |
features
Deprecated.
|
protected SerializeFilter[] |
filters
Deprecated.
|
private java.lang.String[] |
jsonpParameterNames
jsonp parameter name
|
private java.util.Set<java.lang.String> |
renderedAttributes
renderedAttributes
|
private boolean |
updateContentLength
updateContentLength
|
| Constructor and Description |
|---|
FastJsonJsonView()
Set default param.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
filterModel(java.util.Map<java.lang.String,java.lang.Object> model)
Filters out undesired attributes from the given model.
|
java.nio.charset.Charset |
getCharset()
Deprecated.
|
java.lang.String |
getDateFormat()
Deprecated.
|
FastJsonConfig |
getFastJsonConfig() |
SerializerFeature[] |
getFeatures()
Deprecated.
|
SerializeFilter[] |
getFilters()
Deprecated.
|
private java.lang.String |
getJsonpParameterValue(javax.servlet.http.HttpServletRequest request) |
boolean |
isExtractValueFromSingleKeyModel()
Check extractValueFromSingleKeyModel.
|
protected void |
prepareResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
renderMergedOutputModel(java.util.Map<java.lang.String,java.lang.Object> model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
setCharset(java.nio.charset.Charset charset)
Deprecated.
|
void |
setDateFormat(java.lang.String dateFormat)
Deprecated.
|
void |
setDisableCaching(boolean disableCaching)
Disables caching of the generated JSON.
|
void |
setExtractValueFromSingleKeyModel(boolean extractValueFromSingleKeyModel)
Set extractValueFromSingleKeyModel.
|
void |
setFastJsonConfig(FastJsonConfig fastJsonConfig) |
void |
setFeatures(SerializerFeature... features)
Deprecated.
|
void |
setFilters(SerializeFilter... filters)
Deprecated.
|
void |
setJsonpParameterNames(java.util.Set<java.lang.String> jsonpParameterNames)
Set JSONP request parameter names.
|
void |
setRenderedAttributes(java.util.Set<java.lang.String> renderedAttributes)
Set renderedAttributes.
|
protected void |
setResponseContentType(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
setSerializerFeature(SerializerFeature... features)
Deprecated.
|
void |
setUpdateContentLength(boolean updateContentLength)
Whether to update the 'Content-Length' header of the response.
|
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, toString, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextpublic static final java.lang.String DEFAULT_CONTENT_TYPE
public static final java.lang.String DEFAULT_JSONP_CONTENT_TYPE
private static final java.util.regex.Pattern CALLBACK_PARAM_PATTERN
@Deprecated protected java.nio.charset.Charset charset
@Deprecated protected SerializerFeature[] features
@Deprecated protected SerializeFilter[] filters
@Deprecated protected java.lang.String dateFormat
private java.util.Set<java.lang.String> renderedAttributes
private boolean disableCaching
private boolean updateContentLength
private boolean extractValueFromSingleKeyModel
private FastJsonConfig fastJsonConfig
private java.lang.String[] jsonpParameterNames
public FastJsonConfig getFastJsonConfig()
public void setFastJsonConfig(FastJsonConfig fastJsonConfig)
fastJsonConfig - the fastJsonConfig to set.@Deprecated public void setSerializerFeature(SerializerFeature... features)
features - the featuresFastJsonConfig.setSerializerFeatures(SerializerFeature...)@Deprecated public java.nio.charset.Charset getCharset()
FastJsonConfig.getCharset()@Deprecated public void setCharset(java.nio.charset.Charset charset)
charset - the charsetFastJsonConfig.setCharset(Charset)@Deprecated public java.lang.String getDateFormat()
FastJsonConfig.getDateFormat()@Deprecated public void setDateFormat(java.lang.String dateFormat)
dateFormat - the date formatFastJsonConfig.setDateFormat(String)@Deprecated public SerializerFeature[] getFeatures()
FastJsonConfig.getSerializerFeatures()@Deprecated public void setFeatures(SerializerFeature... features)
features - the featuresFastJsonConfig.setSerializerFeatures(SerializerFeature...)@Deprecated public SerializeFilter[] getFilters()
FastJsonConfig.getSerializeFilters()@Deprecated public void setFilters(SerializeFilter... filters)
filters - the filtersFastJsonConfig.setSerializeFilters(SerializeFilter...)public void setRenderedAttributes(java.util.Set<java.lang.String> renderedAttributes)
renderedAttributes - renderedAttributespublic boolean isExtractValueFromSingleKeyModel()
public void setExtractValueFromSingleKeyModel(boolean extractValueFromSingleKeyModel)
extractValueFromSingleKeyModel - extractValueFromSingleKeyModelpublic void setJsonpParameterNames(java.util.Set<java.lang.String> jsonpParameterNames)
The parameter names configured by default are "jsonp" and "callback".
private java.lang.String getJsonpParameterValue(javax.servlet.http.HttpServletRequest request)
protected void renderMergedOutputModel(java.util.Map<java.lang.String,java.lang.Object> model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
renderMergedOutputModel in class org.springframework.web.servlet.view.AbstractViewjava.lang.Exceptionprotected void prepareResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
prepareResponse in class org.springframework.web.servlet.view.AbstractViewpublic void setDisableCaching(boolean disableCaching)
Default is true, which will prevent the client from caching the
generated JSON.
public void setUpdateContentLength(boolean updateContentLength)
true, the response is buffered in order to determine the
content length and set the 'Content-Length' header of the response.
The default setting is false.
protected java.lang.Object filterModel(java.util.Map<java.lang.String,java.lang.Object> model)
Map, or a single value object.
Default implementation removes BindingResult instances and
entries not included in the renderedAttributes property.
model - the model, as passed on to renderMergedOutputModel(java.util.Map<java.lang.String, java.lang.Object>, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)protected void setResponseContentType(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
setResponseContentType in class org.springframework.web.servlet.view.AbstractView