public class JSONWriterUtil
extends java.lang.Object
Enables to specify a write mode while adding a JSON property. According to the provided write mode, the property value may be encoded through the XSS protection service
Modifier and Type | Class and Description |
---|---|
static class |
JSONWriterUtil.WriteMode
JSON write modes
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_SUFFIX_XSS
Key suffix for XSS protected properties
|
Constructor and Description |
---|
JSONWriterUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
put(JSONObject object,
java.lang.String key,
java.lang.String value,
JSONWriterUtil.WriteMode writeMode,
XSSProtectionService xss)
Puts a value into a JSON object according to provided write mode.
|
static void |
putOptional(JSONObject object,
java.lang.String key,
java.lang.String value,
JSONWriterUtil.WriteMode writeMode,
XSSProtectionService xss)
Puts an optional value into a JSON object according to provided write mode.
|
static void |
write(JSONWriter writer,
java.lang.String key,
java.lang.String value,
JSONWriterUtil.WriteMode writeMode,
XSSProtectionService xss)
Writes a value to JSON writer according to provided write mode.
|
static void |
writeOptional(JSONWriter writer,
java.lang.String key,
java.lang.String value,
JSONWriterUtil.WriteMode writeMode,
XSSProtectionService xss)
Writes an optional value to JSON writer according to provided write mode.
|
public static final java.lang.String KEY_SUFFIX_XSS
public static void put(JSONObject object, java.lang.String key, java.lang.String value, JSONWriterUtil.WriteMode writeMode, XSSProtectionService xss) throws JSONException
object
- JSON objectkey
- Key to writevalue
- Value to writewriteMode
- Write modexss
- XSS protection serviceJSONException
- If value could not be put into the objectpublic static void putOptional(JSONObject object, java.lang.String key, java.lang.String value, JSONWriterUtil.WriteMode writeMode, XSSProtectionService xss) throws JSONException
object
- JSON objectkey
- Key to writevalue
- Value to writewriteMode
- Write modexss
- XSS protection serviceJSONException
- If value could not be put into the objectpublic static void write(JSONWriter writer, java.lang.String key, java.lang.String value, JSONWriterUtil.WriteMode writeMode, XSSProtectionService xss) throws JSONException
writer
- JSON writerkey
- Key to writevalue
- Value to writewriteMode
- Write modexss
- XSS protection serviceJSONException
- If value could not be writtenpublic static void writeOptional(JSONWriter writer, java.lang.String key, java.lang.String value, JSONWriterUtil.WriteMode writeMode, XSSProtectionService xss) throws JSONException
writer
- JSON writerkey
- Key to writevalue
- Value to writewriteMode
- Write modexss
- XSS protection serviceJSONException
- If value could not be writtenCopyright © 2010 - 2020 Adobe. All Rights Reserved