Package net.sf.json.util
Class WebUtils
- java.lang.Object
-
- net.sf.json.util.WebUtils
-
public class WebUtils extends Object
Provides useful methods for working with JSON and web.- Author:
- Andres Almiray
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static WebHijackPreventionStrategygetWebHijackPreventionStrategy()Returns the configured WebHijackPreventionStrategy.static Stringprotect(JSON json)Transforms the input Json string using the configured WebHijackPreventionStrategy.static Stringprotect(JSON json, boolean shrink)Transforms the input Json string using the configured WebHijackPreventionStrategy.static voidsetWebHijackPreventionStrategy(WebHijackPreventionStrategy strategy)Sets a WebHijackPreventionStrategy.
Will use default value (WebHijackPreventionStrategy.INFINITE_LOOP) if null.static StringtoString(JSON json)Returns a string represenation of a JSON value.
When an object property name does not contain a space (' ') or a colon (':'), the quotes are omitted.
-
-
-
Method Detail
-
getWebHijackPreventionStrategy
public static WebHijackPreventionStrategy getWebHijackPreventionStrategy()
Returns the configured WebHijackPreventionStrategy.
-
protect
public static String protect(JSON json)
Transforms the input Json string using the configured WebHijackPreventionStrategy.- Parameters:
json- the input string- Returns:
- String a transformed json string
-
protect
public static String protect(JSON json, boolean shrink)
Transforms the input Json string using the configured WebHijackPreventionStrategy.- Parameters:
json- the input stringshrink- if redundant key quotes may be eliminated.- Returns:
- String a transformed json string
-
setWebHijackPreventionStrategy
public static void setWebHijackPreventionStrategy(WebHijackPreventionStrategy strategy)
Sets a WebHijackPreventionStrategy.
Will use default value (WebHijackPreventionStrategy.INFINITE_LOOP) if null.
-
-