Methods Summary |
---|
private void | init()
permittedTaglibs = null;
failed = false;
|
private java.util.Set | readConfiguration()Returns Set of permitted taglibs, based on configuration data.
// initialize the Set
Set s = new HashSet();
// get the space-separated list of taglibs
String uris = (String) getInitParameters().get(PERMITTED_TAGLIBS_PARAM);
// separate the list into individual uris and store them
StringTokenizer st = new StringTokenizer(uris);
while (st.hasMoreTokens())
s.add(st.nextToken());
// return the new Set
return s;
|
public void | release()
super.release();
init();
|
public synchronized javax.servlet.jsp.tagext.ValidationMessage[] | validate(java.lang.String prefix, java.lang.String uri, javax.servlet.jsp.tagext.PageData page)
try {
// initialize
this.uri = uri;
permittedTaglibs = readConfiguration();
// get a handler
DefaultHandler h = new PermittedTaglibsHandler();
// parse the page
SAXParserFactory f = SAXParserFactory.newInstance();
f.setValidating(true);
SAXParser p = f.newSAXParser();
p.parse(page.getInputStream(), h);
if (failed)
return vmFromString(
"taglib " + prefix + " (" + uri + ") allows only the "
+ "following taglibs to be imported: " + permittedTaglibs);
else
return null;
} catch (SAXException ex) {
return vmFromString(ex.toString());
} catch (ParserConfigurationException ex) {
return vmFromString(ex.toString());
} catch (IOException ex) {
return vmFromString(ex.toString());
}
|
private javax.servlet.jsp.tagext.ValidationMessage[] | vmFromString(java.lang.String message)
return new ValidationMessage[] {
new ValidationMessage(null, message)
};
|