in jelly-tags/jetty/src/main/java/org/apache/commons/jelly/tags/jetty/SecurityHandlerTag.java [94:146]
public void doTag(XMLOutput xmlOutput) throws JellyTagException {
HttpContextTag httpContext = (HttpContextTag) findAncestorWithClass(
HttpContextTag.class);
if ( httpContext == null ) {
throw new JellyTagException( "<securityHandler> tag must be enclosed inside a <httpContext> tag" );
}
SecurityHandler securityHandler = new SecurityHandler();
if (getauthenticationMethod() != null) {
securityHandler.setAuthMethod(getauthenticationMethod());
}
httpContext.addHandler(securityHandler);
// get the security constraints from the body of this tag
// by parsing the body of the parent (so it will be well formed)
String bodyText = getBodyText();
StringReader reader = new StringReader(bodyText);
InputSource inputSource = new InputSource(reader);
// crate a non-validating parser
XmlParser xmlParser = new XmlParser(false);
XmlParser.Node node = null;
try {
node = xmlParser.parse(inputSource);
}
catch (IOException e) {
throw new JellyTagException(e);
}
catch (SAXException e) {
throw new JellyTagException(e);
}
Iterator iter=node.iterator();
XmlParser.Node currNode = null;
while (iter.hasNext())
{
Object o = iter.next();
if (!(o instanceof XmlParser.Node))
continue;
currNode=(XmlParser.Node)o;
String name=currNode.getTag();
if ("security-constraint".equals(name)) {
initSecurityConstraint(currNode, httpContext);
} else if ("login-config".equals(name)) {
initLoginConfig(currNode, httpContext);
} else {
throw new JellyTagException("Invalid element in <securityHandler> tag. Are you using the <constraints> tag?: " + currNode);
}
}
}