Search in sources :

Example 6 with RuleSet

use of org.apache.tomcat.util.digester.RuleSet in project tomcat by apache.

the class ContextConfig method createContextDigester.

/**
 * Create (if necessary) and return a Digester configured to process the
 * context configuration descriptor for an application.
 * @return the digester for context.xml files
 */
protected Digester createContextDigester() {
    Digester digester = new Digester();
    digester.setValidating(false);
    digester.setRulesValidation(true);
    Map<Class<?>, List<String>> fakeAttributes = new HashMap<>();
    List<String> objectAttrs = new ArrayList<>();
    objectAttrs.add("className");
    fakeAttributes.put(Object.class, objectAttrs);
    // Ignore attribute added by Eclipse for its internal tracking
    List<String> contextAttrs = new ArrayList<>();
    contextAttrs.add("source");
    fakeAttributes.put(StandardContext.class, contextAttrs);
    digester.setFakeAttributes(fakeAttributes);
    RuleSet contextRuleSet = new ContextRuleSet("", false);
    digester.addRuleSet(contextRuleSet);
    RuleSet namingRuleSet = new NamingRuleSet("Context/");
    digester.addRuleSet(namingRuleSet);
    return digester;
}
Also used : RuleSet(org.apache.tomcat.util.digester.RuleSet) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Digester(org.apache.tomcat.util.digester.Digester) ArrayList(java.util.ArrayList) JavaClass(org.apache.tomcat.util.bcel.classfile.JavaClass) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

RuleSet (org.apache.tomcat.util.digester.RuleSet)6 IOException (java.io.IOException)3 ConnectException (java.net.ConnectException)3 LifecycleException (org.apache.catalina.LifecycleException)3 Digester (org.apache.tomcat.util.digester.Digester)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 JavaClass (org.apache.tomcat.util.bcel.classfile.JavaClass)2 SAXParseException (org.xml.sax.SAXParseException)2