[OWASP-stinger] loadRuleset does not work with ear in wls
Thomas Schmidt
tsc at itserve.ch
Tue May 31 06:23:42 EDT 2005
The loadRulesets(String path) method does not work for files in an ear that
runs in weblogic server:
**
* Load any rulesets stored in SVDL files on the path. This method
stores the time each file was
* modified in a hashmap, and reloads if any of the files were modified.
*
* @param path the path to the SVDL files
*/
private void loadRuleSets(String path)....
The following code works:
/**
* Load any rulesets stored in SVDL file-InputStream.
*
* @param svdlStream the InputStraem of a SVDL file
*/
private void loadRuleSets(InputStream svdlStream)
{
Builder builder = new Builder();
try {
Document d = builder.build(svdlStream);
rulesets.put(new Integer(1), parseRuleSet(d));
} catch (Exception e) {
log.error(" > Error loading svdlStream -- skipping", e);
}
}
A new getInstance(InputStream svdlStream) method is necessary:
/**
* Returns the singleton instance
*/
public static Stinger getInstance(InputStream svdlStream) {
if (instance == null) {
instance = new Stinger();
}
instance.loadRuleSets(svdlStream);
return instance;
}
It would be called like this:
public void init(FilterConfig config) throws ServletException {
this.config = config;
try {
InputStream svdlStream =
config.getServletContext().getResourceAsStream("/WEB-INF/rules/sample.svdl")
;
stinger = Stinger.getInstance(svdlStream);
} catch (Exception ex) {
log.error("", ex);
}
}
Would it be posibble to have a similar getInstance(InputStream svdlStream)
method in a next release ?
Thanks Thomas
More information about the Owasp-stinger
mailing list