Package org.apache.struts2.json
Class JSONCleaner
java.lang.Object
org.apache.struts2.json.JSONCleaner
Isolate the process of cleaning JSON data from the Interceptor class itself.
The allowed and blocked wildcard patterns, combined with defaultBlock, let you filter out values that should not be injected, in the same way that ParameterFilterInterceptor does. Note that you can only remove values from a Map. Removing values from a List is dangerous because it could change the meaning of the data!
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectprotected Objectprotected abstract ObjectcleanValue(String ognlName, Object data) booleanvoidsetAllowed(String allowed) voidsetAllowedCollection(Collection<String> allowed) voidsetBlocked(String blocked) voidsetBlockedCollection(Collection<String> blocked) voidsetDefaultBlock(boolean defaultExclude) voidAllow external caching of the compiled result.
-
Constructor Details
-
JSONCleaner
public JSONCleaner()
-
-
Method Details
-
clean
- Throws:
JSONException
-
cleanList
- Throws:
JSONException
-
cleanMap
- Throws:
JSONException
-
cleanValue
- Throws:
JSONException
-
getIncludesExcludesMap
- Returns:
- the compiled list of includes and excludes
-
setIncludesExcludesMap
Allow external caching of the compiled result.- Parameters:
map- the compiled list of includes and excludes
-
isDefaultBlock
public boolean isDefaultBlock()- Returns:
- value of defaultBlock
-
setDefaultBlock
public void setDefaultBlock(boolean defaultExclude) - Parameters:
defaultExclude- The defaultExclude to set.
-
getBlockedCollection
- Returns:
- list of blocked wildcard patterns
-
setBlockedCollection
- Parameters:
blocked- The blocked to set.
-
setBlocked
- Parameters:
blocked- The blocked parameters as comma separated String.
-
getAllowedCollection
- Returns:
- list of allowed wildcard patterns
-
setAllowedCollection
- Parameters:
allowed- The allowed to set.
-
setAllowed
- Parameters:
allowed- The allowed paramters as comma separated String.
-