1 Index: container/catalina/src/share/org/apache/catalina/core/StandardContext.java
2 ===================================================================
3 --- container/catalina/src/share/org/apache/catalina/core/StandardContext.java (wersja 781541)
4 +++ container/catalina/src/share/org/apache/catalina/core/StandardContext.java (wersja 781542)
6 ((Lifecycle) pipeline).start();
9 - if(getProcessTlds()) {
13 // Notify our interested LifecycleListeners
14 lifecycle.fireLifecycleEvent(START_EVENT, null);
16 @@ -4278,40 +4274,6 @@
22 - * @throws LifecycleException If an error occurs
24 - protected void processTlds() throws LifecycleException {
25 - TldConfig tldConfig = new TldConfig();
26 - tldConfig.setContext(this);
28 - // (1) check if the attribute has been defined
29 - // on the context element.
30 - tldConfig.setTldValidation(tldValidation);
31 - tldConfig.setTldNamespaceAware(tldNamespaceAware);
33 - // (2) if the attribute wasn't defined on the context
35 - if (!tldValidation) {
36 - tldConfig.setTldValidation
37 - (((StandardHost) getParent()).getXmlValidation());
40 - if (!tldNamespaceAware) {
41 - tldConfig.setTldNamespaceAware
42 - (((StandardHost) getParent()).getXmlNamespaceAware());
46 - tldConfig.execute();
47 - } catch (Exception ex) {
48 - log.error("Error reading tld listeners "
49 - + ex.toString(), ex);
54 * Stop this Context component.
56 * @exception LifecycleException if a shutdown error occurs
57 @@ -5083,6 +5045,10 @@
62 + this.addLifecycleListener(new TldConfig());
67 // Notify our interested LifecycleListeners
68 Index: container/catalina/src/share/org/apache/catalina/startup/TldConfig.java
69 ===================================================================
70 --- container/catalina/src/share/org/apache/catalina/startup/TldConfig.java (wersja 781541)
71 +++ container/catalina/src/share/org/apache/catalina/startup/TldConfig.java (wersja 781542)
74 import org.apache.catalina.Context;
75 import org.apache.catalina.Globals;
76 +import org.apache.catalina.Lifecycle;
77 +import org.apache.catalina.LifecycleEvent;
78 +import org.apache.catalina.LifecycleListener;
79 import org.apache.catalina.core.StandardContext;
80 +import org.apache.catalina.core.StandardHost;
81 import org.apache.catalina.util.StringManager;
82 import org.apache.tomcat.util.digester.Digester;
83 import org.xml.sax.InputSource;
86 - * Startup event listener for a <b>Context</b> that configures the properties
87 - * of that Context, and the associated defined servlets.
88 + * Startup event listener for a <b>Context</b> that configures application
89 + * listeners configured in any TLD files.
91 * @author Craig R. McClanahan
92 * @author Jean-Francois Arcand
93 * @author Costin Manolache
95 -public final class TldConfig {
96 +public final class TldConfig implements LifecycleListener {
98 // Names of JARs that are known not to contain any TLDs
99 private static HashSet noTldJars;
104 - * Create (if necessary) and return a Digester configured to process a tag
105 - * library descriptor, looking for additional listener classes to be
108 - private static Digester createTldDigester() {
110 - return DigesterFactory.newDigester(tldValidation,
118 * Scan the JAR file at the specified resource path for TLDs in the
119 * <code>META-INF</code> subdirectory, and scan each TLD for application
120 * event listeners that need to be registered.
122 private void tldScanStream(InputSource resourceStream)
125 - if (tldDigester == null){
126 - tldDigester = createTldDigester();
129 synchronized (tldDigester) {
131 tldDigester.push(this);
137 + public void lifecycleEvent(LifecycleEvent event) {
138 + // Identify the context we are associated with
140 + context = (Context) event.getLifecycle();
141 + } catch (ClassCastException e) {
142 + log.error(sm.getString("tldConfig.cce", event.getLifecycle()), e);
146 + if (event.getType().equals(Lifecycle.INIT_EVENT)) {
148 + } else if (event.getType().equals(Lifecycle.START_EVENT)) {
151 + } catch (Exception e) {
152 + log.error(sm.getString(
153 + "tldConfig.execute", context.getPath()), e);
155 + } // Ignore the other event types - nothing to do
158 + private void init() {
159 + if (tldDigester == null){
160 + // (1) check if the attribute has been defined
161 + // on the context element.
162 + setTldValidation(context.getTldValidation());
163 + setTldNamespaceAware(context.getTldNamespaceAware());
165 + // (2) if the attribute wasn't defined on the context
167 + if (!tldValidation) {
169 + ((StandardHost) context.getParent()).getXmlValidation());
172 + if (!tldNamespaceAware) {
173 + setTldNamespaceAware(
174 + ((StandardHost) context.getParent()).getXmlNamespaceAware());
177 + tldDigester = DigesterFactory.newDigester(tldValidation,
180 + tldDigester.getParser();
184 Index: container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
185 ===================================================================
186 --- container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties (wersja 781541)
187 +++ container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties (wersja 781542)
189 hostConfig.undeploy=Undeploying context [{0}]
190 hostConfig.undeploy.error=Error undeploying web application at context path {0}
191 hostConfig.undeploying=Undeploying deployed web applications
192 +tldConfig.cce=Lifecycle event data object {0} is not a Context
193 +tldConfig.execute=Error processing TLD files for context path {0}
194 userConfig.database=Exception loading user database
195 userConfig.deploy=Deploying web application for user {0}
196 userConfig.deploying=Deploying user web applications