|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork2.interceptor.AbstractInterceptor
org.apache.struts2.json.JSONInterceptor
public class JSONInterceptor
Populates an action from a JSON string
Constructor Summary | |
---|---|
JSONInterceptor()
|
Method Summary | |
---|---|
protected java.lang.String |
addCallbackIfApplicable(javax.servlet.http.HttpServletRequest request,
java.lang.String json)
|
java.lang.String |
getCallbackParameter()
|
boolean |
getDebug()
|
protected java.util.List |
getIncludeProperties()
Returns the appropriate set of includes, based on debug setting. |
java.lang.String |
intercept(ActionInvocation invocation)
|
RPCResponse |
invoke(java.lang.Object object,
java.util.Map data)
|
boolean |
isEnableGZIP()
|
boolean |
isEnableSMD()
|
boolean |
isExcludeNullProperties()
|
boolean |
isNoCache()
|
void |
setCallbackParameter(java.lang.String callbackParameter)
|
void |
setContentType(java.lang.String contentType)
|
void |
setDebug(boolean debug)
Turns debugging on or off |
void |
setDefaultEncoding(java.lang.String val)
|
void |
setDevMode(java.lang.String mode)
|
void |
setEnableGZIP(boolean enableGZIP)
Setting this property to "true" will compress the output. |
void |
setEnableSMD(boolean enableSMD)
|
void |
setExcludeNullProperties(boolean excludeNullProperties)
Do not serialize properties with a null value |
void |
setExcludeProperties(java.lang.String commaDelim)
Sets a comma-delimited list of regular expressions to match properties that should be excluded from the JSON output. |
void |
setExcludeWildcards(java.lang.String commaDelim)
Sets a comma-delimited list of wildcard expressions to match properties that should be excluded from the JSON output. |
void |
setIgnoreHierarchy(boolean ignoreHierarchy)
Ignore properties defined on base classes of the root object. |
void |
setIgnoreSMDMethodInterfaces(boolean ignoreSMDMethodInterfaces)
Ignore annotations on methods in interfaces You may need to set to this true if your action is a proxy/enhanced as annotations are not inherited |
void |
setIncludeProperties(java.lang.String commaDelim)
Sets a comma-delimited list of regular expressions to match properties that should be included from the JSON output. |
void |
setIncludeWildcards(java.lang.String commaDelim)
Sets a comma-delimited list of wildcard expressions to match properties that should be included from the JSON output. |
void |
setJSONCleaner(JSONCleaner dataCleaner)
Sets the JSONCleaner to be used |
void |
setJSONPopulator(JSONPopulator populator)
Sets the JSONPopulator to be used |
void |
setNoCache(boolean noCache)
Add headers to response to prevent the browser from caching the response |
void |
setPrefix(boolean prefix)
Add "{} && " to generated JSON |
void |
setRoot(java.lang.String root)
Sets the root object to be deserialized, defaults to the Action |
void |
setWrapWithComments(boolean wrapWithComments)
Wrap generated JSON with comments. |
Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor |
---|
destroy, init |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSONInterceptor()
Method Detail |
---|
public java.lang.String intercept(ActionInvocation invocation) throws java.lang.Exception
intercept
in interface Interceptor
intercept
in class AbstractInterceptor
java.lang.Exception
public RPCResponse invoke(java.lang.Object object, java.util.Map data) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, JSONException, java.lang.InstantiationException, java.lang.NoSuchMethodException, java.beans.IntrospectionException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
JSONException
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.beans.IntrospectionException
protected java.lang.String addCallbackIfApplicable(javax.servlet.http.HttpServletRequest request, java.lang.String json)
public boolean isEnableSMD()
public void setEnableSMD(boolean enableSMD)
public void setIgnoreSMDMethodInterfaces(boolean ignoreSMDMethodInterfaces)
public void setWrapWithComments(boolean wrapWithComments)
wrapWithComments
- public void setDefaultEncoding(java.lang.String val)
public void setIgnoreHierarchy(boolean ignoreHierarchy)
ignoreHierarchy
- public void setRoot(java.lang.String root)
root
- OGNL expression of root object to be serializedpublic void setJSONPopulator(JSONPopulator populator)
populator
- JSONPopulatorpublic void setJSONCleaner(JSONCleaner dataCleaner)
dataCleaner
- JSONCleanerpublic boolean getDebug()
public void setDebug(boolean debug)
debug
- true or falsepublic void setDevMode(java.lang.String mode)
public void setExcludeProperties(java.lang.String commaDelim)
commaDelim
- A comma-delimited list of regular expressionspublic void setExcludeWildcards(java.lang.String commaDelim)
commaDelim
- A comma-delimited list of wildcard expressionspublic void setIncludeProperties(java.lang.String commaDelim)
commaDelim
- A comma-delimited list of regular expressionspublic void setIncludeWildcards(java.lang.String commaDelim)
commaDelim
- A comma-delimited list of wildcard expressionsprotected java.util.List getIncludeProperties()
public boolean isEnableGZIP()
public void setEnableGZIP(boolean enableGZIP)
enableGZIP
- Enable compressed outputpublic boolean isNoCache()
public void setNoCache(boolean noCache)
noCache
- public boolean isExcludeNullProperties()
public void setExcludeNullProperties(boolean excludeNullProperties)
excludeNullProperties
- public void setCallbackParameter(java.lang.String callbackParameter)
public java.lang.String getCallbackParameter()
public void setPrefix(boolean prefix)
prefix
- public void setContentType(java.lang.String contentType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |