|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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)
|
void |
destroy()
|
java.lang.String |
getCallbackParameter()
|
boolean |
getDebug()
Turns debugging on or off |
void |
init()
|
java.lang.String |
intercept(com.opensymphony.xwork2.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)
|
void |
setDefaultEncoding(java.lang.String val)
|
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 |
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 |
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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JSONInterceptor()
| Method Detail |
|---|
public void destroy()
destroy in interface com.opensymphony.xwork2.interceptor.Interceptorpublic void init()
init in interface com.opensymphony.xwork2.interceptor.Interceptor
public java.lang.String intercept(com.opensymphony.xwork2.ActionInvocation invocation)
throws java.lang.Exception
intercept in interface com.opensymphony.xwork2.interceptor.Interceptorjava.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()
debug - true or falsepublic void setDebug(boolean debug)
public void setExcludeProperties(java.lang.String commaDelim)
commaDelim - A comma-delimited list of regular expressionspublic void setIncludeProperties(java.lang.String commaDelim)
commaDelim - A comma-delimited list of regular expressionspublic 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 | |||||||||