|
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
This is the base class for all filters. The purpose of the filter mechanism is to remove possibly harmful html code that could be injected into dynamic html code by a hacker. The resulting code may steal users passwords from clients and do other bad things to their machines. Expresso implements transparent filtering by automatically filtering all string content from databases and input parameters.
1 - Derive a class from Filter. The name of the class should be the name of the characterset you're using. If the characterset's name includes hyphens, substitute underscores ('_') for the hyphens in naming your filter.
2 - Create two arrays, one contains the characters that are special control characters and should be taken care of. The second array contains the strings that will be substituted whenever one of the control characters is encountered (in standardMethod)
3 - In your default constructor, pass those two arrays to the constructor of the base Filter Class
For a working example see
ISO_8859_1| Constructor Summary | |
Filter()
|
|
Filter(String[] specialChars,
String[] replacementStrings)
Constructor that fills that creates and fills the replacementList. |
|
| Method Summary | |
String |
rawFilter(String data)
rawFilter actually doesn't do anything its simply returns an exact copy of the original. |
String |
standardFilter(String data)
This filter HTML encodes all special characters defined by the replacement list. |
String |
stripFilter(String data)
This filter strips out all special characters defined by the replacement list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Filter()
public Filter(String[] specialChars,
String[] replacementStrings)
throws IllegalArgumentException
specialChars - - the array of special character Strings we need to filter.replacementStrings - - the array of strings the special characters map
to
IllegalArgumentException - if specialChars.length()
!= replacementStrings.length()| Method Detail |
public String rawFilter(String data)
data - The String to scan.
public String standardFilter(String data)
data - The string to encode.
public String stripFilter(String data)
data - The string to scan.
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||