Package org.apache.struts2.json
Class StrutsJSONReader
java.lang.Object
org.apache.struts2.json.StrutsJSONReader
- All Implemented Interfaces:
JSONReader
Deserializes an object from a JSON string with configurable limits to prevent denial-of-service attacks via malicious payloads.
-
Field Summary
Fields inherited from interface org.apache.struts2.json.JSONReader
DEFAULT_MAX_DEPTH, DEFAULT_MAX_ELEMENTS, DEFAULT_MAX_KEY_LENGTH, DEFAULT_MAX_STRING_LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd()protected voidadd(char cc) protected voidarray()protected JSONExceptionprotected charnext()protected Objectnumber()object()protected Objectread()voidsetMaxDepth(int maxDepth) voidsetMaxElements(int maxElements) voidsetMaxKeyLength(int maxKeyLength) voidsetMaxStringLength(int maxStringLength) protected voidprotected Objectstring(char quote) protected charunicode()
-
Constructor Details
-
StrutsJSONReader
public StrutsJSONReader()
-
-
Method Details
-
setMaxElements
public void setMaxElements(int maxElements) - Specified by:
setMaxElementsin interfaceJSONReader
-
setMaxDepth
public void setMaxDepth(int maxDepth) - Specified by:
setMaxDepthin interfaceJSONReader
-
setMaxStringLength
public void setMaxStringLength(int maxStringLength) - Specified by:
setMaxStringLengthin interfaceJSONReader
-
setMaxKeyLength
public void setMaxKeyLength(int maxKeyLength) - Specified by:
setMaxKeyLengthin interfaceJSONReader
-
next
protected char next() -
skipWhiteSpace
protected void skipWhiteSpace() -
read
- Specified by:
readin interfaceJSONReader- Throws:
JSONException
-
read
- Throws:
JSONException
-
object
- Throws:
JSONException
-
buildInvalidInputException
-
array
- Throws:
JSONException
-
number
- Throws:
JSONException
-
string
- Throws:
JSONException
-
add
protected void add(char cc) -
add
protected void add() -
addDigits
protected void addDigits() -
unicode
protected char unicode()
-