📄 webruleset.java
字号:
digester.addCallMethod(prefix + "web-app/message-destination/description",
"setDescription", 0);
digester.addCallMethod(prefix + "web-app/message-destination/display-name",
"setDisplayName", 0);
digester.addCallMethod(prefix + "web-app/message-destination/icon/large-icon",
"setLargeIcon", 0);
digester.addCallMethod(prefix + "web-app/message-destination/icon/small-icon",
"setSmallIcon", 0);
digester.addCallMethod(prefix + "web-app/message-destination/message-destination-name",
"setName", 0);
digester.addObjectCreate(prefix + "web-app/message-destination-ref",
"org.apache.catalina.deploy.MessageDestinationRef");
digester.addSetNext(prefix + "web-app/message-destination-ref",
"addMessageDestinationRef",
"org.apache.catalina.deploy.MessageDestinationRef");
digester.addCallMethod(prefix + "web-app/message-destination-ref/description",
"setDescription", 0);
digester.addCallMethod(prefix + "web-app/message-destination-ref/message-destination-link",
"setLink", 0);
digester.addCallMethod(prefix + "web-app/message-destination-ref/message-destination-ref-name",
"setName", 0);
digester.addCallMethod(prefix + "web-app/message-destination-ref/message-destination-type",
"setType", 0);
digester.addCallMethod(prefix + "web-app/message-destination-ref/message-destination-usage",
"setUsage", 0);
digester.addObjectCreate(prefix + "web-app/resource-ref",
"org.apache.catalina.deploy.ContextResource");
digester.addSetNext(prefix + "web-app/resource-ref",
"addResource",
"org.apache.catalina.deploy.ContextResource");
digester.addCallMethod(prefix + "web-app/resource-ref/description",
"setDescription", 0);
digester.addCallMethod(prefix + "web-app/resource-ref/res-auth",
"setAuth", 0);
digester.addCallMethod(prefix + "web-app/resource-ref/res-ref-name",
"setName", 0);
digester.addCallMethod(prefix + "web-app/resource-ref/res-sharing-scope",
"setScope", 0);
digester.addCallMethod(prefix + "web-app/resource-ref/res-type",
"setType", 0);
digester.addObjectCreate(prefix + "web-app/security-constraint",
"org.apache.catalina.deploy.SecurityConstraint");
digester.addSetNext(prefix + "web-app/security-constraint",
"addConstraint",
"org.apache.catalina.deploy.SecurityConstraint");
digester.addRule(prefix + "web-app/security-constraint/auth-constraint",
new SetAuthConstraintRule());
digester.addCallMethod(prefix + "web-app/security-constraint/auth-constraint/role-name",
"addAuthRole", 0);
digester.addCallMethod(prefix + "web-app/security-constraint/display-name",
"setDisplayName", 0);
digester.addCallMethod(prefix + "web-app/security-constraint/user-data-constraint/transport-guarantee",
"setUserConstraint", 0);
digester.addObjectCreate(prefix + "web-app/security-constraint/web-resource-collection",
"org.apache.catalina.deploy.SecurityCollection");
digester.addSetNext(prefix + "web-app/security-constraint/web-resource-collection",
"addCollection",
"org.apache.catalina.deploy.SecurityCollection");
digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/http-method",
"addMethod", 0);
digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/url-pattern",
"addPattern", 0);
digester.addCallMethod(prefix + "web-app/security-constraint/web-resource-collection/web-resource-name",
"setName", 0);
digester.addCallMethod(prefix + "web-app/security-role/role-name",
"addSecurityRole", 0);
digester.addRule(prefix + "web-app/servlet",
new WrapperCreateRule());
digester.addSetNext(prefix + "web-app/servlet",
"addChild",
"org.apache.catalina.Container");
digester.addCallMethod(prefix + "web-app/servlet/init-param",
"addInitParameter", 2);
digester.addCallParam(prefix + "web-app/servlet/init-param/param-name",
0);
digester.addCallParam(prefix + "web-app/servlet/init-param/param-value",
1);
digester.addCallMethod(prefix + "web-app/servlet/jsp-file",
"setJspFile", 0);
digester.addCallMethod(prefix + "web-app/servlet/load-on-startup",
"setLoadOnStartupString", 0);
digester.addCallMethod(prefix + "web-app/servlet/run-as/role-name",
"setRunAs", 0);
digester.addCallMethod(prefix + "web-app/servlet/security-role-ref",
"addSecurityReference", 2);
digester.addCallParam(prefix + "web-app/servlet/security-role-ref/role-link", 1);
digester.addCallParam(prefix + "web-app/servlet/security-role-ref/role-name", 0);
digester.addCallMethod(prefix + "web-app/servlet/servlet-class",
"setServletClass", 0);
digester.addCallMethod(prefix + "web-app/servlet/servlet-name",
"setName", 0);
digester.addCallMethod(prefix + "web-app/servlet-mapping",
"addServletMapping", 2);
digester.addCallParam(prefix + "web-app/servlet-mapping/servlet-name", 1);
digester.addCallParam(prefix + "web-app/servlet-mapping/url-pattern", 0);
digester.addRule(prefix + "web-app/session-config",
sessionConfig);
digester.addCallMethod(prefix + "web-app/session-config/session-timeout",
"setSessionTimeout", 1,
new Class[] { Integer.TYPE });
digester.addCallParam(prefix + "web-app/session-config/session-timeout", 0);
digester.addCallMethod(prefix + "web-app/taglib",
"addTaglib", 2);
digester.addCallParam(prefix + "web-app/taglib/taglib-location", 1);
digester.addCallParam(prefix + "web-app/taglib/taglib-uri", 0);
digester.addCallMethod(prefix + "web-app/welcome-file-list/welcome-file",
"addWelcomeFile", 0);
digester.addCallMethod(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping",
"addLocaleEncodingMappingParameter", 2);
digester.addCallParam(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping/locale", 0);
digester.addCallParam(prefix + "web-app/locale-encoding-mapping-list/locale-encoding-mapping/encoding", 1);
}
/**
* Reset counter used for validating the web.xml file.
*/
public void recycle(){
jspConfig.isJspConfigSet = false;
sessionConfig.isSessionConfigSet = false;
loginConfig.isLoginConfigSet = false;
}
}
// ----------------------------------------------------------- Private Classes
/**
* Rule to check that the <code>login-config</code> is occuring
* only 1 time within the web.xml
*/
final class SetLoginConfig extends Rule {
protected boolean isLoginConfigSet = false;
public SetLoginConfig() {
}
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
if (isLoginConfigSet){
throw new IllegalArgumentException(
"<login-config> element is limited to 1 occurance");
}
isLoginConfigSet = true;
}
}
/**
* Rule to check that the <code>jsp-config</code> is occuring
* only 1 time within the web.xml
*/
final class SetJspConfig extends Rule {
protected boolean isJspConfigSet = false;
public SetJspConfig() {
}
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
if (isJspConfigSet){
throw new IllegalArgumentException(
"<jsp-config> element is limited to 1 occurance");
}
isJspConfigSet = true;
}
}
/**
* Rule to check that the <code>jsp-config</code> is occuring
* only 1 time within the web.xml
*/
final class SetSessionConfig extends Rule {
protected boolean isSessionConfigSet = false;
public SetSessionConfig() {
}
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
if (isSessionConfigSet){
throw new IllegalArgumentException(
"<session-config> element is limited to 1 occurance");
}
isSessionConfigSet = true;
}
}
/**
* A Rule that calls the <code>setAuthConstraint(true)</code> method of
* the top item on the stack, which must be of type
* <code>org.apache.catalina.deploy.SecurityConstraint</code>.
*/
final class SetAuthConstraintRule extends Rule {
public SetAuthConstraintRule() {
}
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
SecurityConstraint securityConstraint =
(SecurityConstraint) digester.peek();
securityConstraint.setAuthConstraint(true);
if (digester.getLogger().isDebugEnabled()) {
digester.getLogger()
.debug("Calling SecurityConstraint.setAuthConstraint(true)");
}
}
}
/**
* Class that calls <code>setDistributable(true)</code> for the top object
* on the stack, which must be a <code>org.apache.catalina.Context</code>.
*/
final class SetDistributableRule extends Rule {
public SetDistributableRule() {
}
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
Context context = (Context) digester.peek();
context.setDistributable(true);
if (digester.getLogger().isDebugEnabled()) {
digester.getLogger().debug
(context.getClass().getName() + ".setDistributable( true)");
}
}
}
/**
* Class that calls a property setter for the top object on the stack,
* passing the public ID of the entity we are currently processing.
*/
final class SetPublicIdRule extends Rule {
public SetPublicIdRule(String method) {
this.method = method;
}
private String method = null;
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
Context context = (Context) digester.peek(digester.getCount() - 1);
Object top = digester.peek();
Class paramClasses[] = new Class[1];
paramClasses[0] = "String".getClass();
String paramValues[] = new String[1];
paramValues[0] = digester.getPublicId();
Method m = null;
try {
m = top.getClass().getMethod(method, paramClasses);
} catch (NoSuchMethodException e) {
digester.getLogger().error("Can't find method " + method + " in "
+ top + " CLASS " + top.getClass());
return;
}
m.invoke(top, paramValues);
if (digester.getLogger().isDebugEnabled())
digester.getLogger().debug("" + top.getClass().getName() + "."
+ method + "(" + paramValues[0] + ")");
}
}
/**
* A Rule that calls the factory method on the specified Context to
* create the object that is to be added to the stack.
*/
final class WrapperCreateRule extends Rule {
public WrapperCreateRule() {
}
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
Context context =
(Context) digester.peek(digester.getCount() - 1);
Wrapper wrapper = context.createWrapper();
digester.push(wrapper);
if (digester.getLogger().isDebugEnabled())
digester.getLogger().debug("new " + wrapper.getClass().getName());
}
public void end(String namespace, String name)
throws Exception {
Wrapper wrapper = (Wrapper) digester.pop();
if (digester.getLogger().isDebugEnabled())
digester.getLogger().debug("pop " + wrapper.getClass().getName());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -