* Create and return an XmlMapper configured to process the web application
* deployment descriptor (web.xml).
*/
private XmlMapper createWebMapper() {
XmlMapper mapper = new XmlMapper();
if (debug > 0)
mapper.setDebug(3);
mapper.setValidating(true);
mapper.registerDTDRes(Constants.WebDtdPublicId_22,
Constants.WebDtdResourcePath_22);
mapper.registerDTDRes(Constants.WebDtdPublicId_23,
Constants.WebDtdResourcePath_23);
mapper.addRule("web-app",
new SetPublicIdAction("setPublicId"));
mapper.addRule("web-app/context-param",
mapper.methodSetter("addParameter", 2));
mapper.addRule("web-app/context-param/param-name",
mapper.methodParam(0));
mapper.addRule("web-app/context-param/param-value",
mapper.methodParam(1));
mapper.addRule("web-app/display-name",
mapper.methodSetter("setDisplayName", 0));
mapper.addRule("web-app/distributable",
new SetDistributableAction());
mapper.addRule("web-app/ejb-local-ref",
mapper.objectCreate("org.apache.catalina.deploy.ContextLocalEjb"));
mapper.addRule("web-app/ejb-local-ref",
mapper.addChild("addLocalEjb",
"org.apache.catalina.deploy.ContextLocalEjb"));
mapper.addRule("web-app/ejb-local-ref/description",
mapper.methodSetter("setDescription", 0));
mapper.addRule("web-app/ejb-local-ref/ejb-ref-name",
mapper.methodSetter("setName", 0));
mapper.addRule("web-app/ejb-local-ref/ejb-ref-type",
mapper.methodSetter("setType", 0));
mapper.addRule("web-app/ejb-local-ref/local-home",
mapper.methodSetter("setHome", 0));
mapper.addRule("web-app/ejb-local-ref/local",
mapper.methodSetter("setLocal", 0));
mapper.addRule("web-app/ejb-local-ref/ejb-link",
mapper.methodSetter("setLink", 0));
mapper.addRule("web-app/ejb-ref",
mapper.objectCreate("org.apache.catalina.deploy.ContextEjb"));
mapper.addRule("web-app/ejb-ref",
mapper.addChild("addEjb",
"org.apache.catalina.deploy.ContextEjb"));
mapper.addRule("web-app/ejb-ref/description",
mapper.methodSetter("setDescription", 0));
mapper.addRule("web-app/ejb-ref/ejb-ref-name",
mapper.methodSetter("setName", 0));
mapper.addRule("web-app/ejb-ref/ejb-ref-type",
mapper.methodSetter("setType", 0));
mapper.addRule("web-app/ejb-ref/home",
mapper.methodSetter("setHome", 0));
mapper.addRule("web-app/ejb-ref/remote",
mapper.methodSetter("setRemote", 0));
mapper.addRule("web-app/ejb-ref/ejb-link",
mapper.methodSetter("setLink", 0));
mapper.addRule("web-app/env-entry",
mapper.objectCreate("org.apache.catalina.deploy.ContextEnvironment"));
mapper.addRule("web-app/env-entry",
mapper.addChild("addEnvironment",
"org.apache.catalina.deploy.ContextEnvironment"));
mapper.addRule("web-app/env-entry/env-entry-description",
mapper.methodSetter("setDescription", 0));
mapper.addRule("web-app/env-entry/env-entry-name",
mapper.methodSetter("setName", 0));
mapper.addRule("web-app/env-entry/env-entry-type",
mapper.methodSetter("setType", 0));
mapper.addRule("web-app/env-entry/env-entry-value",
mapper.methodSetter("setValue", 0));
mapper.addRule("web-app/error-page",
mapper.objectCreate("org.apache.catalina.deploy.ErrorPage"));
mapper.addRule("web-app/error-page",
mapper.addChild("addErrorPage",
"org.apache.catalina.deploy.ErrorPage"));
mapper.addRule("web-app/error-page/error-code",
mapper.methodSetter("setErrorCode", 0));
mapper.addRule("web-app/error-page/exception-type",
mapper.methodSetter("setExceptionType", 0));
mapper.addRule("web-app/error-page/location",
mapper.methodSetter("setLocation", 0));
mapper.addRule("web-app/filter",
mapper.objectCreate("org.apache.catalina.deploy.FilterDef"));
mapper.addRule("web-app/filter",
mapper.addChild("addFilterDef",
"org.apache.catalina.deploy.FilterDef"));
mapper.addRule("web-app/filter/description",
mapper.methodSetter("setDescription", 0));
mapper.addRule("web-app/filter/display-name",
mapper.methodSetter("setDisplayName", 0));
mapper.addRule("web-app/filter/filter-class",
mapper.methodSetter("setFilterClass", 0));
mapper.addRule("web-app/filter/filter-name",
mapper.methodSetter("setFilterName", 0));
mapper.addRule("web-app/filter/icon/large-icon",
mapper.methodSetter("setLargeIcon", 0));
mapper.addRule("web-app/filter/icon/small-icon",
mapper.methodSetter("setSmallIcon", 0));
mapper.addRule("web-app/filter/init-param",
mapper.methodSetter("addInitParameter", 2));
mapper.addRule("web-app/filter/init-param/param-name",
mapper.methodParam(0));
mapper.addRule("web-app/filter/init-param/param-value",
mapper.methodParam(1));
mapper.addRule("web-app/filter-mapping",
mapper.objectCreate("org.apache.catalina.deploy.FilterMap"));
mapper.addRule("web-app/filter-mapping",
mapper.addChild("addFilterMap",
"org.apache.catalina.deploy.FilterMap"));
mapper.addRule("web-app/filter-mapping/filter-name",
mapper.methodSetter("setFilterName", 0));
mapper.addRule("web-app/filter-mapping/servlet-name",
mapper.methodSetter("setServletName", 0));
mapper.addRule("web-app/filter-mapping/url-pattern",
mapper.methodSetter("setURLPattern", 0));
mapper.addRule("web-app/listener/listener-class",
mapper.methodSetter("addApplicationListener", 0));
mapper.addRule("web-app/login-config",
mapper.objectCreate("org.apache.catalina.deploy.LoginConfig"));
mapper.addRule("web-app/login-config",
mapper.addChild("setLoginConfig",
"org.apache.catalina.deploy.LoginConfig"));
mapper.addRule("web-app/login-config/auth-method",
mapper.methodSetter("setAuthMethod", 0));
mapper.addRule("web-app/login-config/realm-name",
mapper.methodSetter("setRealmName", 0));
mapper.addRule("web-app/login-config/form-login-config/form-login-page",
mapper.methodSetter("setLoginPage", 0));
mapper.addRule("web-app/login-config/form-login-config/form-error-page",
mapper.methodSetter("setErrorPage", 0));
mapper.addRule("web-app/mime-mapping",
mapper.methodSetter("addMimeMapping", 2));
mapper.addRule("web-app/mime-mapping/extension",
mapper.methodParam(0));
mapper.addRule("web-app/mime-mapping/mime-type",
mapper.methodParam(1));
mapper.addRule("web-app/resource-env-ref",
mapper.methodSetter("addResourceEnvRef", 2));
mapper.addRule("web-app/resource-env-ref/resource-env-ref-name",
mapper.methodParam(0));
mapper.addRule("web-app/resource-env-ref/resource-env-ref-type",
mapper.methodParam(1));
mapper.addRule("web-app/resource-ref",
mapper.objectCreate("org.apache.catalina.deploy.ContextResource"));
mapper.addRule("web-app/resource-ref",
mapper.addChild("addResource",
"org.apache.catalina.deploy.ContextResource"));
mapper.addRule("web-app/resource-ref/description",
mapper.methodSetter("setDescription", 0));
mapper.addRule("web-app/resource-ref/res-auth",
mapper.methodSetter("setAuth", 0));
mapper.addRule("web-app/resource-ref/res-ref-name",
mapper.methodSetter("setName", 0));
mapper.addRule("web-app/resource-ref/res-sharing-scope",
mapper.methodSetter("setScope", 0));
mapper.addRule("web-app/resource-ref/res-type",
mapper.methodSetter("setType", 0));
mapper.addRule("web-app/security-constraint",
mapper.objectCreate("org.apache.catalina.deploy.SecurityConstraint"));
mapper.addRule("web-app/security-constraint",
mapper.addChild("addConstraint",
"org.apache.catalina.deploy.SecurityConstraint"));
mapper.addRule("web-app/security-constraint/auth-constraint",
new SetAuthConstraint());
mapper.addRule("web-app/security-constraint/auth-constraint/role-name",
mapper.methodSetter("addAuthRole", 0));
mapper.addRule("web-app/security-constraint/display-name",
mapper.methodSetter("setDisplayName", 0));
mapper.addRule("web-app/security-constraint/user-data-constraint/transport-guarantee",
mapper.methodSetter("setUserConstraint", 0));
mapper.addRule("web-app/security-constraint/web-resource-collection",
mapper.objectCreate("org.apache.catalina.deploy.SecurityCollection"));
mapper.addRule("web-app/security-constraint/web-resource-collection",
mapper.addChild("addCollection",
"org.apache.catalina.deploy.SecurityCollection"));
mapper.addRule("web-app/security-constraint/web-resource-collection/http-method",
mapper.methodSetter("addMethod", 0));
mapper.addRule("web-app/security-constraint/web-resource-collection/url-pattern",
mapper.methodSetter("addPattern", 0));
mapper.addRule("web-app/security-constraint/web-resource-collection/web-resource-name",
mapper.methodSetter("setName", 0));
mapper.addRule("web-app/security-role",
mapper.methodSetter("addSecurityRole", 1));
mapper.addRule("web-app/security-role/role-name",
mapper.methodParam(0));
mapper.addRule("web-app/servlet",
new WrapperCreate(context));
mapper.addRule("web-app/servlet",
mapper.addChild("addChild",
"org.apache.catalina.Container"));
mapper.addRule("web-app/servlet/init-param",
mapper.methodSetter("addInitParameter", 2));
mapper.addRule("web-app/servlet/init-param/param-name",
mapper.methodParam(0));
mapper.addRule("web-app/servlet/init-param/param-value",
mapper.methodParam(1));
mapper.addRule("web-app/servlet/jsp-file",
mapper.methodSetter("setJspFile", 0));
mapper.addRule("web-app/servlet/load-on-startup",
mapper.methodSetter("setLoadOnStartupString", 0));
mapper.addRule("web-app/servlet/run-as/role-name",
mapper.methodSetter("setRunAs", 0));
mapper.addRule("web-app/servlet/security-role-ref",
mapper.methodSetter("addSecurityReference", 2));
mapper.addRule("web-app/servlet/security-role-ref/role-link",
mapper.methodParam(1));
mapper.addRule("web-app/servlet/security-role-ref/role-name",
mapper.methodParam(0));
mapper.addRule("web-app/servlet/servlet-class",
mapper.methodSetter("setServletClass", 0));
mapper.addRule("web-app/servlet/servlet-name",
mapper.methodSetter("setName", 0));
mapper.addRule("web-app/servlet-mapping",
mapper.methodSetter("addServletMapping", 2));
mapper.addRule("web-app/servlet-mapping/servlet-name",
mapper.methodParam(1));
mapper.addRule("web-app/servlet-mapping/url-pattern",
mapper.methodParam(0));
mapper.addRule("web-app/session-config",
mapper.methodSetter("setSessionTimeout", 1,
new String[]{"int"}));
mapper.addRule("web-app/session-config/session-timeout",
mapper.methodParam(0));
mapper.addRule("web-app/taglib",
mapper.methodSetter("addTaglib", 2));
mapper.addRule("web-app/taglib/taglib-location",
mapper.methodParam(1));
mapper.addRule("web-app/taglib/taglib-uri",
mapper.methodParam(0));
mapper.addRule("web-app/welcome-file-list/welcome-file",
mapper.methodSetter("addWelcomeFile", 0));
return (mapper);
}