|
||||||||||
| 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 String |
addCallbackIfApplicable(javax.servlet.http.HttpServletRequest request,
String json)
|
String |
getCallbackParameter()
|
boolean |
getDebug()
|
protected List |
getIncludeProperties()
Returns the appropriate set of includes, based on debug setting. |
String |
intercept(com.opensymphony.xwork2.ActionInvocation invocation)
|
RPCResponse |
invoke(Object object,
Map data)
|
boolean |
isEnableGZIP()
|
boolean |
isEnableSMD()
|
boolean |
isExcludeNullProperties()
|
boolean |
isNoCache()
|
void |
setCallbackParameter(String callbackParameter)
|
void |
setContentType(String contentType)
|
void |
setDebug(boolean debug)
Turns debugging on or off |
void |
setDefaultEncoding(String val)
|
void |
setDevMode(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(String commaDelim)
Sets a comma-delimited list of regular expressions to match properties that should be excluded from the JSON output. |
void |
setExcludeWildcards(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(String commaDelim)
Sets a comma-delimited list of regular expressions to match properties that should be included from the JSON output. |
void |
setIncludeWildcards(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(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 String intercept(com.opensymphony.xwork2.ActionInvocation invocation)
throws Exception
intercept in interface com.opensymphony.xwork2.interceptor.Interceptorintercept in class com.opensymphony.xwork2.interceptor.AbstractInterceptorException
public RPCResponse invoke(Object object,
Map data)
throws IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
JSONException,
InstantiationException,
NoSuchMethodException,
IntrospectionException
IllegalArgumentException
IllegalAccessException
InvocationTargetException
JSONException
InstantiationException
NoSuchMethodException
IntrospectionException
protected String addCallbackIfApplicable(javax.servlet.http.HttpServletRequest request,
String json)
public boolean isEnableSMD()
public void setEnableSMD(boolean enableSMD)
public void setIgnoreSMDMethodInterfaces(boolean ignoreSMDMethodInterfaces)
public void setWrapWithComments(boolean wrapWithComments)
wrapWithComments - public void setDefaultEncoding(String val)
public void setIgnoreHierarchy(boolean ignoreHierarchy)
ignoreHierarchy - public void setRoot(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(String mode)
public void setExcludeProperties(String commaDelim)
commaDelim - A comma-delimited list of regular expressionspublic void setExcludeWildcards(String commaDelim)
commaDelim - A comma-delimited list of wildcard expressionspublic void setIncludeProperties(String commaDelim)
commaDelim - A comma-delimited list of regular expressionspublic void setIncludeWildcards(String commaDelim)
commaDelim - A comma-delimited list of wildcard expressionsprotected 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(String callbackParameter)
public String getCallbackParameter()
public void setPrefix(boolean prefix)
prefix - public void setContentType(String contentType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||