|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.portalpages.rest.utils.JSONSerializer
public class JSONSerializer
Field Summary | |
---|---|
protected XPHashtable |
m_object
|
Constructor Summary | |
---|---|
JSONSerializer(XPHashtable jsonObject)
|
Method Summary | |
---|---|
protected java.lang.String |
AddPadding(int level)
Helper for adding the proper amount of indentation |
java.lang.String |
GenerateStringRepresentation(boolean addPrefix)
Main parsing function |
protected java.lang.String |
GetStringValue(java.lang.Object val,
java.lang.String name)
Returns JSON string representation of a value. |
protected java.lang.String |
ParseArray(IXPList values,
int level)
Generate JSON string representation for Array node The generated output will be in the following format: [ value1, value2, value3, ... |
protected java.lang.String |
ParseHashTable(XPHashtable map,
int level)
Generate JSON String representation for node with child nodes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected XPHashtable m_object
Constructor Detail |
---|
public JSONSerializer(XPHashtable jsonObject)
Method Detail |
---|
public java.lang.String GenerateStringRepresentation(boolean addPrefix)
addPrefix
- Protects the JSON string from rewrites/pollution/hijacking hacks by prefixing
the generated JSON with '{} && '. The prefix is skipped by the eval function
when interpreting the JSON as data, i.e. transforming the JSON into an object
with properties but turns the JSON into unexecutable javascript to protect against
various CSRF vunerabilities
protected java.lang.String ParseHashTable(XPHashtable map, int level)
map
- level
- The depth from the top where top is 0
protected java.lang.String ParseArray(IXPList values, int level)
values
- level
-
protected java.lang.String AddPadding(int level)
level
-
protected java.lang.String GetStringValue(java.lang.Object val, java.lang.String name)
val
- name
-
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |