public class Filter extends Object
| Constructor and Description |
|---|
Filter() |
| Modifier and Type | Method and Description |
|---|---|
static String |
asCssColor(String color)
asCssColor is useful when you need to insert dynamic data into a CSS color context, e.g.
|
static String |
asCssColor(String color,
String defaultColor)
Identical to asCssColor, except you can provide your own default value
|
static String |
asFlexibleURL(String url)
This function should be semantically identical to the above function with the exception
of using a scheme blacklist instead of a scheme whitelist.
|
static String |
asNumber(String number)
asNumber is useful for outputting dynamic data as a number in a JavaScript
context, e.g.
|
static String |
asNumber(String number,
String defaultNumber)
Identical to asNumber, except you can provide your own default value
|
static String |
asURL(String url)
URL filtering to ensure that the URL is a safe non-relative URL or transforms it to a safe relative URL.
|
public static String asNumber(String number)
number - the potential number to filterpublic static String asNumber(String number, String defaultNumber)
number - the potential number to filterdefaultNumber - a default String to return if the number argument is not a Numberpublic static String asCssColor(String color)
color - the potential css color to filterpublic static String asCssColor(String color, String defaultColor)
color - the potential css color to filterdefaultColor - a default String to return if the color argument is not a potentially valid CSS colorpublic static String asURL(String url)
Specifically, if the URL starts with one of the following it will be unaltered:
url - The potentially tainted URL to be Filterednull if input is nullpublic static String asFlexibleURL(String url)
url - The potentially tainted URL to be Filterednull if input is nullCopyright © 2013. All Rights Reserved.