void addSecurity( XmlMapper xh ) {
xh.addRule("web-app/security-constraint",
new SCAction() );
xh.addRule("web-app/security-constraint/user-data-constraint/transport-guarantee",
new XmlAction() {
public void end( SaxContext ctx) throws Exception {
Stack st=ctx.getObjectStack();
SecurityConstraint rc=(SecurityConstraint)st.peek();
String body=ctx.getBody().trim();
rc.setTransport( body );
}
}
);
xh.addRule("web-app/security-constraint/auth-constraint/role-name",
new XmlAction() {
public void end( SaxContext ctx) throws Exception {
Stack st=ctx.getObjectStack();
SecurityConstraint rc=(SecurityConstraint)st.peek();
String body=ctx.getBody().trim();
rc.addRole( body );
}
}
);
xh.addRule("web-app/security-constraint/web-resource-collection",
new XmlAction() {
public void start( SaxContext ctx) throws Exception {
Stack st=ctx.getObjectStack();
st.push(new ResourceCollection());
}
public void end( SaxContext ctx) throws Exception {
Stack st=ctx.getObjectStack();
ResourceCollection rc=(ResourceCollection)st.pop();
SecurityConstraint sc=(SecurityConstraint)st.peek();
st.push( rc );
sc.addResourceCollection( rc );
}
public void cleanup( SaxContext ctx) {
Stack st=ctx.getObjectStack();
Object o=st.pop();
}
}
);
xh.addRule("web-app/security-constraint/web-resource-collection/url-pattern",
new XmlAction() {
public void end( SaxContext ctx) throws Exception {
Stack st=ctx.getObjectStack();
ResourceCollection rc=(ResourceCollection)st.peek();
String body=ctx.getBody().trim();
rc.addUrlPattern( body );
}
}
);
xh.addRule("web-app/security-constraint/web-resource-collection/http-method",
new XmlAction() {
public void end( SaxContext ctx) throws Exception {
Stack st=ctx.getObjectStack();
ResourceCollection rc=(ResourceCollection)st.peek();
String body=ctx.getBody().trim();
rc.addHttpMethod( body );