|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.security.filters.Filter
com.jcorporate.expresso.core.security.filters.HtmlFilter
com.jcorporate.expresso.core.security.filters.HtmlPlusURLFilter
This class provides a filter implementation for HTML output, protecting against
XSS exploits, plus it creates anchor () tags for anything that starts
with 'http://', 'www.', etc.
| Field Summary | |
static String |
MAX_CHARS_IN_URL_LABEL
Name for Setup value which decides if we are limiting anchor labels |
static String[] |
URL_INFORMAL_PREFIXES
|
static String[] |
URL_TYPES
|
| Fields inherited from class com.jcorporate.expresso.core.security.filters.HtmlFilter |
REPLACE_LIST, SPECIAL_STRING_LIST |
| Constructor Summary | |
HtmlPlusURLFilter()
No-args constructor required |
|
HtmlPlusURLFilter(String[] specialStringList,
String[] replaceList)
Constructor for passing strings and their replacements |
|
| Method Summary | |
static String |
addHttpPrefixIfNeeded(String url)
Given a url string, if it's null or equals "" then just return it as is. |
static int |
findEndOfHref(String s,
int start)
Finds the end of a hyperlink |
static String |
getWebHostPort(ControllerRequest request)
Get web server address |
static boolean |
hasValidUrlPrefix(String url)
Return true if the url has a valid prefix, like http:// |
static String |
insertHrefTags(String s)
Insert a href tag around any http, https, www, or www2 strings |
static boolean |
isValidUrl(String url)
Return true if the url is valid. |
String |
standardFilter(String data)
This filter HTML encodes all special characters defined by the replacement list. |
| Methods inherited from class com.jcorporate.expresso.core.security.filters.Filter |
rawFilter, stripFilter |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String[] URL_TYPES
public static final String[] URL_INFORMAL_PREFIXES
public static final String MAX_CHARS_IN_URL_LABEL
| Constructor Detail |
public HtmlPlusURLFilter()
throws IllegalArgumentException
public HtmlPlusURLFilter(String[] specialStringList,
String[] replaceList)
throws IllegalArgumentException
specialStringList - Strings to replacereplaceList - The replacement strings| Method Detail |
public String standardFilter(String data)
standardFilter in class Filterdata - The string to encode.
public static String addHttpPrefixIfNeeded(String url)
url - The url string
public static boolean hasValidUrlPrefix(String url)
url -
public static boolean isValidUrl(String url)
url - The candidate URL to check
public static String getWebHostPort(ControllerRequest request)
public static String insertHrefTags(String s)
s - The string to search in and insert
public static int findEndOfHref(String s,
int start)
s - The stringstart - The url's starting index
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||