cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
billbarker2005/09/24 17:27:53 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix problem of double-init when JMX-deploying a Context into a started Host. It doesn't seem possible to stop init being called twice in this scenario (at least with the current JMX-deployment logic :), so let the second call do the actual work and make the first call quit. Based on a patch submitted by: Darran Lofthouse Fix for Bug #36802 Revision ChangesPath 1.177 +5 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.176 retrieving revision 1.177 diff -u -r1.176 -r1.177 --- StandardContext.java 12 Sep 2005 00:19:38 - 1.176 +++ StandardContext.java 25 Sep 2005 00:27:53 - 1.177 @@ -5034,6 +5034,10 @@ destroy(); throw e; } +// It's possible that addChild may have started us +if( initialized ) { +return; +} } super.init(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2005/04/19 11:30:21 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: No longer ignore the wrapper class passed to Context.setWrapperClass(). I think the original intent of this method was to pass a class that implements the Wrapper interface. However, there are too many dependencies in the code right now that assume the children of StandardContext to be instances of StandardWrapper (instead of Wrapper), which means the class passed to StandardContext.setWrapperClass() really must be a subclass of StandardWrapper. Revision ChangesPath 1.174 +32 -8 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.173 retrieving revision 1.174 diff -u -r1.173 -r1.174 --- StandardContext.java 25 Mar 2005 18:12:48 - 1.173 +++ StandardContext.java 19 Apr 2005 18:30:21 - 1.174 @@ -549,7 +549,8 @@ /** * Java class name of the Wrapper class implementation we use. */ -private String wrapperClass = "org.apache.catalina.core.StandardWrapper"; +private String wrapperClassName = StandardWrapper.class.getName(); +private Class wrapperClass = null; /** @@ -1647,7 +1648,7 @@ */ public String getWrapperClass() { -return (this.wrapperClass); +return (this.wrapperClassName); } @@ -1656,12 +1657,25 @@ * Set the Java class name of the Wrapper implementation used * for servlets registered in this Context. * - * @param wrapperClass The new wrapper class + * @param wrapperClassName The new wrapper class name + * + * @throws IllegalArgumentException if the specified wrapper class + * cannot be found or is not a subclass of StandardWrapper */ -public void setWrapperClass(String wrapperClass) { +public void setWrapperClass(String wrapperClassName) { -this.wrapperClass = wrapperClass; +this.wrapperClassName = wrapperClassName; +try { +wrapperClass = Class.forName(wrapperClassName); +if (!StandardWrapper.class.isAssignableFrom(wrapperClass)) { +throw new IllegalArgumentException( +sm.getString("standardContext.invalidWrapperClass", + wrapperClassName)); +} +} catch (ClassNotFoundException cnfe) { +throw new IllegalArgumentException(cnfe.getMessage()); +} } @@ -2372,8 +2386,18 @@ * will have been called, but no properties will have been set. */ public Wrapper createWrapper() { -//log.info( "Create wrapper" ); -Wrapper wrapper = new StandardWrapper(); + +Wrapper wrapper = null; +if (wrapperClass != null) { +try { +wrapper = (Wrapper) wrapperClass.newInstance(); +} catch (Throwable t) { +log.error("createWrapper", t); +return (null); +} +} else { +wrapper = new StandardWrapper(); +} synchronized (instanceListeners) { for (int i = 0; i < instanceListeners.length; i++) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2005/03/25 10:12:48 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Minor adjustment to fix for 32866: Issue log message about propagating value of "distributable" to manager only if there is a manager in place Revision ChangesPath 1.173 +5 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.172 retrieving revision 1.173 diff -u -r1.172 -r1.173 --- StandardContext.java 25 Mar 2005 16:47:44 - 1.172 +++ StandardContext.java 25 Mar 2005 18:12:48 - 1.173 @@ -1200,10 +1200,11 @@ new Boolean(this.distributable)); // Bugzilla 32866 -if(log.isDebugEnabled()) { -log.debug("Propagating distributable=" + distributable + " to manager"); -} if(getManager() != null) { +if(log.isDebugEnabled()) { +log.debug("Propagating distributable=" + distributable + + " to manager"); +} getManager().setDistributable(distributable); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java LocalStrings_fr.properties LocalStrings_ja.properties LocalStrings.properties LocalStrings_es.properties
remm2005/03/22 02:32:07 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java LocalStrings_fr.properties LocalStrings_ja.properties LocalStrings.properties LocalStrings_es.properties Log: - Improve logging of startup errors. Revision ChangesPath 1.168 +20 -23 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.167 retrieving revision 1.168 diff -u -r1.167 -r1.168 --- StandardContext.java 11 Mar 2005 17:00:28 - 1.167 +++ StandardContext.java 22 Mar 2005 10:32:07 - 1.168 @@ -3514,8 +3514,8 @@ */ public boolean filterStart() { -if (log.isDebugEnabled()) -log.debug("Starting filters"); +if (getLogger().isDebugEnabled()) +getLogger().debug("Starting filters"); // Instantiate and record a FilterConfig for each defined filter boolean ok = true; synchronized (filterConfigs) { @@ -3523,15 +3523,15 @@ Iterator names = filterDefs.keySet().iterator(); while (names.hasNext()) { String name = (String) names.next(); -if (log.isDebugEnabled()) -log.debug(" Starting filter '" + name + "'"); +if (getLogger().isDebugEnabled()) +getLogger().debug(" Starting filter '" + name + "'"); ApplicationFilterConfig filterConfig = null; try { filterConfig = new ApplicationFilterConfig (this, (FilterDef) filterDefs.get(name)); filterConfigs.put(name, filterConfig); } catch (Throwable t) { -getServletContext().log +getLogger().error (sm.getString("standardContext.filterStart", name), t); ok = false; } @@ -3550,16 +3550,16 @@ */ public boolean filterStop() { -if (log.isDebugEnabled()) -log.debug("Stopping filters"); +if (getLogger().isDebugEnabled()) +getLogger().debug("Stopping filters"); // Release all Filter and FilterConfig instances synchronized (filterConfigs) { Iterator names = filterConfigs.keySet().iterator(); while (names.hasNext()) { String name = (String) names.next(); -if (log.isDebugEnabled()) -log.debug(" Stopping filter '" + name + "'"); +if (getLogger().isDebugEnabled()) +getLogger().debug(" Stopping filter '" + name + "'"); ApplicationFilterConfig filterConfig = (ApplicationFilterConfig) filterConfigs.get(name); filterConfig.release(); @@ -3600,21 +3600,21 @@ Object results[] = new Object[listeners.length]; boolean ok = true; for (int i = 0; i < results.length; i++) { -if (log.isDebugEnabled()) -log.debug(" Configuring event listener class '" + +if (getLogger().isDebugEnabled()) +getLogger().debug(" Configuring event listener class '" + listeners[i] + "'"); try { Class clazz = loader.loadClass(listeners[i]); results[i] = clazz.newInstance(); } catch (Throwable t) { -getServletContext().log +getLogger().error (sm.getString("standardContext.applicationListener", listeners[i]), t); ok = false; } } if (!ok) { -log.error(sm.getString("standardContext.applicationSkipped")); + getLogger().error(sm.getString("standardContext.applicationSkipped")); return (false); } @@ -3639,8 +3639,8 @@ // Send application start events -if (log.isDebugEnabled()) -log.debug("Sending application start events"); +if (getLogger().isDebugEnabled()) +getLogger().debug("Sending application start events"); Object instances[] = getApplicationLifecycleListeners(); if (instances == null) @@ -3660,7 +3660,7 @@ fireContainerEvent("afterContextInitialized", listener); } catch (Throwable t) { fireContainerEvent("afterContextInitialized", list
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2005/03/02 10:14:06 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix context classloader binding during loader initialization (it was set to null before). - The webapp loader should only be retrieved when the context classloader is set to the webapp's classloader. The initialization of StandardContainer violates this by having its basic valve instantiated, which in turns gets the logger right away. This means it will use whatever logging configuration is defined for the server classloader :( Revision ChangesPath 1.166 +7 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.165 retrieving revision 1.166 diff -u -r1.165 -r1.166 --- StandardContext.java 24 Feb 2005 17:11:06 - 1.165 +++ StandardContext.java 2 Mar 2005 18:14:06 - 1.166 @@ -4007,8 +4007,6 @@ // Start our subordinate components, if any if ((loader != null) && (loader instanceof Lifecycle)) ((Lifecycle) loader).start(); -if ((logger != null) && (logger instanceof Lifecycle)) -((Lifecycle) logger).start(); // Unbinding thread unbindThread(oldCCL); @@ -4016,6 +4014,8 @@ // Binding thread oldCCL = bindThread(); +if ((logger != null) && (logger instanceof Lifecycle)) +((Lifecycle) logger).start(); if ((cluster != null) && (cluster instanceof Lifecycle)) ((Lifecycle) cluster).start(); if ((realm != null) && (realm instanceof Lifecycle)) @@ -4483,8 +4483,10 @@ if (getResources() == null) return oldContextClassLoader; -Thread.currentThread().setContextClassLoader -(getLoader().getClassLoader()); +if (getLoader().getClassLoader() != null) { +Thread.currentThread().setContextClassLoader +(getLoader().getClassLoader()); +} DirContextURLStreamHandler.bind(getResources()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2005/02/24 09:11:06 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Don't call mkdirs if we're not going to save the configuration. Revision ChangesPath 1.165 +4 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.164 retrieving revision 1.165 diff -u -r1.164 -r1.165 --- StandardContext.java 17 Feb 2005 18:25:51 - 1.164 +++ StandardContext.java 24 Feb 2005 17:11:06 - 1.165 @@ -4594,7 +4594,9 @@ if (host != null) { configBase = new File(configBase, host.getName()); } -configBase.mkdirs(); +if (saveConfig) { +configBase.mkdirs(); +} return configBase; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Remy Maucherat wrote: > [EMAIL PROTECTED] wrote: > >> This patch should fix the issue. >> >> Let me know if you see any problems. > > > There's the same code (and more) in WebappClassLoader.stop(): > > // Clear the classloader reference in common-logging > org.apache.commons.logging.LogFactory.release(this); > // Clear the classloader reference in the VM's bean introspector > java.beans.Introspector.flushCaches(); > > IMO, it's the right place to do this kind of cleaning up in the > classloader, since it's CL related. You're absolutely right. You had fixed this in TC long time ago (revision 1.20). This commit did slip through the cracks, so our internal version was still suffering from this leak. Thanks! Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2005/02/17 10:25:51 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Removed previous patch, since it is already being addressed in WebappClassLoader.stop(). Thanks Remy! Revision ChangesPath 1.164 +1 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.163 retrieving revision 1.164 diff -u -r1.163 -r1.164 --- StandardContext.java 17 Feb 2005 17:55:24 - 1.163 +++ StandardContext.java 17 Feb 2005 18:25:51 - 1.164 @@ -4236,9 +4236,6 @@ // Mark this application as unavailable while we shut down setAvailable(false); -// Remove our classloader from LogFactory's 'factories' cache -LogFactory.release(getLoader().getClassLoader()); - // Binding thread ClassLoader oldCCL = bindThread(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
[EMAIL PROTECTED] wrote: luehe 2005/02/17 09:55:24 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Removed potential WebappClassLoader leak. Consider the following example scenario: - Servlet class references RequestDispatcher. - Servlet is loaded. Any of the symbols referenced will be resolved lazily. - Servlet is invoked. Thread's context classloader has been set to the servlet's WebappClassLoader. - org.apache.catalina.core.ApplicationDispatcher is loaded, and its static "log" variable is initialized as follows: private static Log log = LogFactory.getLog(ApplicationDispatcher.class); - LogFactory.getLog() causes the context classloader (which corresponds to the WebappClassLoader) to be cached in its static "factories" Hashtable, as follows: if (classLoader != null && factory != null) factories.put(classLoader, factory); Right now, this classloader is never removed from this Hashtable when the webapp is stopped. Depending on number of deployed webapps and their servlets' execution paths, different Catalina classes will be loaded on different servlet invocation threads, and the classes' "log" initialization will cause the threads' context classloaders to be cached in LogFactory and never released from it. This patch should fix the issue. Let me know if you see any problems. There's the same code (and more) in WebappClassLoader.stop(): // Clear the classloader reference in common-logging org.apache.commons.logging.LogFactory.release(this); // Clear the classloader reference in the VM's bean introspector java.beans.Introspector.flushCaches(); IMO, it's the right place to do this kind of cleaning up in the classloader, since it's CL related. So -0 for this. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2005/02/17 09:55:24 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Removed potential WebappClassLoader leak. Consider the following example scenario: - Servlet class references RequestDispatcher. - Servlet is loaded. Any of the symbols referenced will be resolved lazily. - Servlet is invoked. Thread's context classloader has been set to the servlet's WebappClassLoader. - org.apache.catalina.core.ApplicationDispatcher is loaded, and its static "log" variable is initialized as follows: private static Log log = LogFactory.getLog(ApplicationDispatcher.class); - LogFactory.getLog() causes the context classloader (which corresponds to the WebappClassLoader) to be cached in its static "factories" Hashtable, as follows: if (classLoader != null && factory != null) factories.put(classLoader, factory); Right now, this classloader is never removed from this Hashtable when the webapp is stopped. Depending on number of deployed webapps and their servlets' execution paths, different Catalina classes will be loaded on different servlet invocation threads, and the classes' "log" initialization will cause the threads' context classloaders to be cached in LogFactory and never released from it. This patch should fix the issue. Let me know if you see any problems. Revision ChangesPath 1.163 +4 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.162 retrieving revision 1.163 diff -u -r1.162 -r1.163 --- StandardContext.java 9 Feb 2005 12:20:40 - 1.162 +++ StandardContext.java 17 Feb 2005 17:55:24 - 1.163 @@ -4236,6 +4236,9 @@ // Mark this application as unavailable while we shut down setAvailable(false); +// Remove our classloader from LogFactory's 'factories' cache +LogFactory.release(getLoader().getClassLoader()); + // Binding thread ClassLoader oldCCL = bindThread(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Mark Thomas wrote: Mark Thomas wrote: Remy Maucherat wrote: I have just re-read the spec and some of the statements in 32559 are certainly wrong. However, I agree with 32559 in that reload and stop/start should have the same effect. I'll put together a simple test case to investigate this. I'll then port this fix back to TC4 plus and further changes the test case throws up. I have looked at this further and the only odd behaviour is that the attribute listeners receive notifications of changes to the welcome files during context stop (and reload). No notifications of changes are received during context start. I don't think this is a major issue but it is inconsistent. I'd like to change it (so no notifications of changes to the welcome files are received on stop) but I couldn't see an easy/obvious way to do this that didn't break something else. Any ideas anyone? I'll look into it. It may be because this is a special readonly attribute, so it wouldn't get removed properly on stop. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Mark Thomas wrote: Remy Maucherat wrote: I think 32559 was actually invalid. I disagree with this fix (which I "fixed" once already), as I think no bug existed in the first place: although it is ok to clear the attribute list to be nice for GC (the containing context is discarded, so it shouldn't be very useful), no notification of attribute removals should be sent. Similarly, attributes addition notifications are not done on startup, as the spec seems to imply they are only to be sent for notifying modifications while the application is running. I have just re-read the spec and some of the statements in 32559 are certainly wrong. However, I agree with 32559 in that reload and stop/start should have the same effect. I'll put together a simple test case to investigate this. I'll then port this fix back to TC4 plus and further changes the test case throws up. I have looked at this further and the only odd behaviour is that the attribute listeners receive notifications of changes to the welcome files during context stop (and reload). No notifications of changes are received during context start. I don't think this is a major issue but it is inconsistent. I'd like to change it (so no notifications of changes to the welcome files are received on stop) but I couldn't see an easy/obvious way to do this that didn't break something else. Any ideas anyone? Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Remy Maucherat wrote: [EMAIL PROTECTED] wrote: markt 2004/12/24 08:50:00 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix bug 32559. add call to context.clearAttributes() I think 32559 was actually invalid. I disagree with this fix (which I "fixed" once already), as I think no bug existed in the first place: although it is ok to clear the attribute list to be nice for GC (the containing context is discarded, so it shouldn't be very useful), no notification of attribute removals should be sent. Similarly, attributes addition notifications are not done on startup, as the spec seems to imply they are only to be sent for notifying modifications while the application is running. Another issue caused by this change: http://issues.apache.org/bugzilla/show_bug.cgi?id=33463 Rémy I have just re-read the spec and some of the statements in 32559 are certainly wrong. However, I agree with 32559 in that reload and stop/start should have the same effect. I'll put together a simple test case to investigate this. I'll then port this fix back to TC4 plus and further changes the test case throws up. Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2005/02/09 04:20:41 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix 33463: remove attributes after context destroy. - Fix typo in two event strings. - Remove dead code. - One small indentation fix. Revision ChangesPath 1.162 +15 -49 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.161 retrieving revision 1.162 diff -u -r1.161 -r1.162 --- StandardContext.java 6 Feb 2005 10:39:32 - 1.161 +++ StandardContext.java 9 Feb 2005 12:20:40 - 1.162 @@ -3698,17 +3698,19 @@ try { fireContainerEvent("beforeContextDestroyed", listener); listener.contextDestroyed(event); -fireContainerEvent("beforeContextDestroyed", listener); +fireContainerEvent("afterContextDestroyed", listener); } catch (Throwable t) { -fireContainerEvent("beforeContextDestroyed", listener); +fireContainerEvent("afterContextDestroyed", listener); getServletContext().log (sm.getString("standardContext.listenerStop", listeners[j].getClass().getName()), t); ok = false; } } + setApplicationEventListeners(null); setApplicationLifecycleListeners(null); + return (ok); } @@ -4032,12 +4034,12 @@ // if any if (pipeline instanceof Lifecycle) { ((Lifecycle) pipeline).start(); - } - +} + if(getProcessTlds()) { - processTlds(); - } - +processTlds(); +} + // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(START_EVENT, null); @@ -4204,43 +4206,7 @@ } } -/** - * Stop this Context component. Experimental, please ignore. - * - * @exception LifecycleException if a shutdown error occurs - */ -public synchronized void stopNew() throws LifecycleException { -// Mark this application as unavailable while we shut down -setAvailable(false); - -// Binding thread -ClassLoader oldCCL = bindThread(); - -try { -// Stop our filters -filterStop(); - -// Finalize our character set mapper -setCharsetMapper(null); - -// Stop our application listeners -listenerStop(); - -// Stop resources -resourcesStop(); - -super.stop(); -} finally { - -// Unbinding thread -unbindThread(oldCCL); - -} - -// Reset application context -context = null; -} - + /** * Stop this Context component. * @@ -4283,10 +4249,6 @@ ((Lifecycle) manager).stop(); } -// Clear all application-originated servlet context attributes -if (context != null) -context.clearAttributes(); - // Finalize our character set mapper setCharsetMapper(null); @@ -4314,6 +4276,10 @@ // Stop our application listeners listenerStop(); +// Clear all application-originated servlet context attributes +if (context != null) +context.clearAttributes(); + // Stop resources resourcesStop(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
[EMAIL PROTECTED] wrote: markt 2004/12/24 08:50:00 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix bug 32559. add call to context.clearAttributes() I think 32559 was actually invalid. I disagree with this fix (which I "fixed" once already), as I think no bug existed in the first place: although it is ok to clear the attribute list to be nice for GC (the containing context is discarded, so it shouldn't be very useful), no notification of attribute removals should be sent. Similarly, attributes addition notifications are not done on startup, as the spec seems to imply they are only to be sent for notifying modifications while the application is running. Another issue caused by this change: http://issues.apache.org/bugzilla/show_bug.cgi?id=33463 Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java mbeans-descriptors.xml
luehe 2005/02/04 15:39:59 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java mbeans-descriptors.xml Log: Added StandardContext "processingTime" attribute, which provides the cumulative processing times of all of the context's servlets Revision ChangesPath 1.160 +23 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.159 retrieving revision 1.160 diff -u -r1.159 -r1.160 --- StandardContext.java 12 Jan 2005 18:19:54 - 1.159 +++ StandardContext.java 4 Feb 2005 23:39:58 - 1.160 @@ -3482,6 +3482,28 @@ } +/** + * Gets the cumulative processing times of all servlets in this + * StandardContext. + * + * @return Cumulative processing times of all servlets in this + * StandardContext + */ +public long getProcessingTime() { + +long result = 0; + +Container[] children = findChildren(); +if (children != null) { +for( int i=0; i< children.length; i++ ) { +result += ((StandardWrapper)children[i]).getProcessingTime(); +} +} + +return result; +} + + // - Public Methods 1.42 +5 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml Index: mbeans-descriptors.xml === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- mbeans-descriptors.xml1 Dec 2004 11:07:16 - 1.41 +++ mbeans-descriptors.xml4 Feb 2005 23:39:59 - 1.42 @@ -175,6 +175,11 @@ description="Time (in milliseconds since January 1, 1970, 00:00:00) when this context was started" type="long"/> + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2005/01/12 10:19:54 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix session persistence on stop (removing the attributes is ok, but the session manager needs the work directory on stop). Revision ChangesPath 1.159 +5 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.158 retrieving revision 1.159 diff -u -r1.158 -r1.159 --- StandardContext.java 24 Dec 2004 16:50:00 - 1.158 +++ StandardContext.java 12 Jan 2005 18:19:54 - 1.159 @@ -4254,16 +4254,16 @@ // Stop our filters filterStop(); -// Clear all application-originated servlet context attributes -if (context != null) -context.clearAttributes(); - // Stop ContainerBackgroundProcessor thread super.threadStop(); if ((manager != null) && (manager instanceof Lifecycle)) { ((Lifecycle) manager).stop(); } + +// Clear all application-originated servlet context attributes +if (context != null) +context.clearAttributes(); // Finalize our character set mapper setCharsetMapper(null); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
markt 2004/12/24 08:50:00 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix bug 32559. add call to context.clearAttributes() Revision ChangesPath 1.158 +5 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.157 retrieving revision 1.158 diff -u -r1.157 -r1.158 --- StandardContext.java 1 Dec 2004 11:07:16 - 1.157 +++ StandardContext.java 24 Dec 2004 16:50:00 - 1.158 @@ -4254,6 +4254,10 @@ // Stop our filters filterStop(); +// Clear all application-originated servlet context attributes +if (context != null) +context.clearAttributes(); + // Stop ContainerBackgroundProcessor thread super.threadStop(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java mbeans-descriptors.xml
pero2004/12/01 03:07:16 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java mbeans-descriptors.xml Log: Add some log.isXXXEnabled Revision ChangesPath 1.157 +35 -19 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.156 retrieving revision 1.157 diff -u -r1.156 -r1.157 --- StandardContext.java 26 Oct 2004 23:43:44 - 1.156 +++ StandardContext.java 1 Dec 2004 11:07:16 - 1.157 @@ -1306,7 +1306,8 @@ String loginPage = config.getLoginPage(); if ((loginPage != null) && !loginPage.startsWith("/")) { if (isServlet22()) { - log.debug(sm.getString("standardContext.loginConfig.loginWarning", +if(log.isDebugEnabled()) + log.debug(sm.getString("standardContext.loginConfig.loginWarning", loginPage)); config.setLoginPage("/" + loginPage); } else { @@ -1318,7 +1319,8 @@ String errorPage = config.getErrorPage(); if ((errorPage != null) && !errorPage.startsWith("/")) { if (isServlet22()) { - log.debug(sm.getString("standardContext.loginConfig.errorWarning", +if(log.isDebugEnabled()) + log.debug(sm.getString("standardContext.loginConfig.errorWarning", errorPage)); config.setErrorPage("/" + errorPage); } else { @@ -1869,7 +1871,8 @@ String jspFile = wrapper.getJspFile(); if ((jspFile != null) && !jspFile.startsWith("/")) { if (isServlet22()) { -log.debug(sm.getString("standardContext.wrapper.warning", +if(log.isDebugEnabled()) + log.debug(sm.getString("standardContext.wrapper.warning", jspFile)); wrapper.setJspFile("/" + jspFile); } else { @@ -1939,7 +1942,8 @@ String location = errorPage.getLocation(); if ((location != null) && !location.startsWith("/")) { if (isServlet22()) { -log.debug(sm.getString("standardContext.errorPage.warning", +if(log.isDebugEnabled()) + log.debug(sm.getString("standardContext.errorPage.warning", location)); errorPage.setLocation("/" + location); } else { @@ -2064,7 +2068,8 @@ if( findChild(servletName) != null) { addServletMapping(pattern, servletName, true); } else { -log.debug("Skiping " + pattern + " , no servlet " + servletName); +if(log.isDebugEnabled()) +log.debug("Skiping " + pattern + " , no servlet " + servletName); } } @@ -2899,7 +2904,8 @@ // if (!reloadable) // throw new IllegalStateException // (sm.getString("standardContext.notReloadable")); -log.info(sm.getString("standardContext.reloadingStarted")); +if(log.isInfoEnabled()) +log.info(sm.getString("standardContext.reloadingStarted")); // Stop accepting requests temporarily setPaused(true); @@ -3837,7 +3843,8 @@ public synchronized void start() throws LifecycleException { //if (lazy ) return; if (started) { -log.info(sm.getString("containerBase.alreadyStarted", logName())); +if(log.isInfoEnabled()) +log.info(sm.getString("containerBase.alreadyStarted", logName())); return; } if( !initialized ) { @@ -3847,8 +3854,8 @@ throw new LifecycleException("Error initializaing ", ex); } } - -log.debug("Starting " + ("".equals(getName()) ? "ROOT" : getName())); +if(log.isDebugEnabled()) +log.debug("Starting " + ("".equals(getName()) ? "ROOT" : getName())); // Set JMX object name for proper pipeline registration preRegisterJMX(); @@ -3902,7 +3909,8 @@ ); } } catch( Throwable t ) { -log.debug("No realm for this host " + realmName); +if(log.isDebugEnabled()) +log.debug("No realm for this host " + realmName); } } @@ -4169,7 +4177,8 @@ oos.close(); fo
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
keith 2004/11/03 14:23:22 Modified:catalina/src/share/org/apache/catalina/core Tag: TOMCAT_5_0 StandardContext.java Log: Backport to 5.0 my patch Remy applied to 5.5 to avoid npes on startup Revision ChangesPath No revision No revision 1.130.2.5 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.130.2.4 retrieving revision 1.130.2.5 diff -u -r1.130.2.4 -r1.130.2.5 --- StandardContext.java 31 Aug 2004 15:08:02 - 1.130.2.4 +++ StandardContext.java 3 Nov 2004 22:23:21 - 1.130.2.5 @@ -4147,7 +4147,7 @@ // Look for a realm - that may have been configured earlier. // If the realm is added after context - it'll set itself. -if( realm == null ) { +if( realm == null && mserver != null ) { ObjectName realmName=null; try { realmName=new ObjectName( getEngineName() + ":type=Host,host=" + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/10/26 16:43:44 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Apply Keith's patch. Revision ChangesPath 1.156 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.155 retrieving revision 1.156 diff -u -r1.155 -r1.156 --- StandardContext.java 26 Oct 2004 15:42:02 - 1.155 +++ StandardContext.java 26 Oct 2004 23:43:44 - 1.156 @@ -3890,7 +3890,7 @@ // Look for a realm - that may have been configured earlier. // If the realm is added after context - it'll set itself. -if( realm == null ) { +if( realm == null && mserver != null ) { ObjectName realmName=null; try { realmName=new ObjectName( getEngineName() + ":type=Realm,host=" + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/10/02 02:22:59 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Remove dead code. Revision ChangesPath 1.151 +1 -44 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.150 retrieving revision 1.151 diff -u -r1.150 -r1.151 --- StandardContext.java 2 Oct 2004 09:22:18 - 1.150 +++ StandardContext.java 2 Oct 2004 09:22:59 - 1.151 @@ -3878,49 +3878,6 @@ setConfigured(false); boolean ok = true; -// Set config file name -/* -File configBase = getConfigBase(); -if ((configBase != null) && saveConfig) { -if (getConfigFile() == null) { -File file = new File(configBase, getDefaultConfigFile()); -setConfigFile(file.getPath()); -// If the docbase is outside the appBase, we should save our -// config -try { -File appBaseFile = new File(getAppBase()); -if (!appBaseFile.isAbsolute()) { -appBaseFile = new File(engineBase(), getAppBase()); -} -String appBase = appBaseFile.getCanonicalPath(); -String basePath = -(new File(getBasePath())).getCanonicalPath(); -if (!basePath.startsWith(appBase)) { -Server server = ServerFactory.getServer(); -((StandardServer) server).storeContext(this); -} -} catch (Exception e) { -log.warn("Error storing config file", e); -} -} else { -try { -String canConfigFile = -(new File(getConfigFile())).getCanonicalPath(); -if (!canConfigFile.startsWith -(configBase.getCanonicalPath())) { -File file = -new File(configBase, getDefaultConfigFile()); -if (copy(new File(canConfigFile), file)) { -setConfigFile(file.getPath()); -} -} -} catch (Exception e) { -log.warn("Error setting config file", e); -} -} -} -*/ - // Add missing components as necessary if (webappResources == null) { // (1) Required by Loader if (log.isDebugEnabled()) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2004/09/30 12:29:04 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Reset startup/start/tldScanTime to 0 in resetContext() Revision ChangesPath 1.149 +4 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.148 retrieving revision 1.149 diff -u -r1.148 -r1.149 --- StandardContext.java 29 Sep 2004 21:07:05 - 1.148 +++ StandardContext.java 30 Sep 2004 19:29:04 - 1.149 @@ -4415,6 +4415,9 @@ // Restore the original state ( pre reading web.xml in start ) // If you extend this - override this method and make sure to clean up children=new HashMap(); +startupTime = 0; +startTime = 0; +tldScanTime = 0; log.debug("resetContext " + oname + " " + mserver); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2004/09/29 14:07:07 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fixed getStartTime() to return time when context was started (instead of time it took to start context) Revision ChangesPath 1.148 +13 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.147 retrieving revision 1.148 diff -u -r1.147 -r1.148 --- StandardContext.java 23 Sep 2004 06:58:51 - 1.147 +++ StandardContext.java 29 Sep 2004 21:07:05 - 1.148 @@ -1079,6 +1079,11 @@ this.defaultWebXml = defaultWebXml; } +/** + * Gets the time (in milliseconds) it took to start this context. + * + * @return Time (in milliseconds) it took to start this context. + */ public long getStartupTime() { return startupTime; } @@ -5408,8 +5413,14 @@ return this.javaVMs = javaVMs; } +/** + * Gets the time this context was started. + * + * @return Time (in milliseconds since January 1, 1970, 00:00:00) when this + * context was started + */ public long getStartTime() { -return startupTime; +return startTime; } public boolean isEventProvider() { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
yoavs 2004/08/31 08:08:02 Modified:catalina/src/share/org/apache/catalina/core Tag: TOMCAT_5_0 StandardContext.java Log: Added missing ), oops ;) Revision ChangesPath No revision No revision 1.130.2.4 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.130.2.3 retrieving revision 1.130.2.4 diff -u -r1.130.2.3 -r1.130.2.4 --- StandardContext.java 31 Aug 2004 14:50:41 - 1.130.2.3 +++ StandardContext.java 31 Aug 2004 15:08:02 - 1.130.2.4 @@ -4262,7 +4262,7 @@ ((Lifecycle) pipeline).start(); } -if(getProcessTlds() { +if(getProcessTlds()) { processTlds(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
yoavs 2004/08/31 08:07:24 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Added missing ), oops ;) Revision ChangesPath 1.144 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.143 retrieving revision 1.144 diff -u -r1.143 -r1.144 --- StandardContext.java 31 Aug 2004 14:41:47 - 1.143 +++ StandardContext.java 31 Aug 2004 15:07:23 - 1.144 @@ -4034,7 +4034,7 @@ ((Lifecycle) pipeline).start(); } -if(getProcessTlds() { +if(getProcessTlds()) { processTlds(); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
yoavs 2004/08/28 16:57:02 Modified:catalina/src/share/org/apache/catalina/core Tag: TOMCAT_5_0 StandardContext.java Log: Making fix to 30762 safer: listener stop must come before loader stop. Revision ChangesPath No revision No revision 1.130.2.2 +4 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.130.2.1 retrieving revision 1.130.2.2 diff -u -r1.130.2.1 -r1.130.2.2 --- StandardContext.java 28 Aug 2004 12:49:54 - 1.130.2.1 +++ StandardContext.java 28 Aug 2004 23:57:02 - 1.130.2.2 @@ -4527,6 +4527,9 @@ ((Lifecycle) children[i]).stop(); } +// Now stop the listeners, Bugzilla 30762 +listenerStop(); + // Stop resources resourcesStop(); @@ -4542,9 +4545,6 @@ if ((loader != null) && (loader instanceof Lifecycle)) { ((Lifecycle) loader).stop(); } - -// Now stop the listeners, Bugzilla 30762 -listenerStop(); } finally { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/08/28 06:54:16 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - I think this is a less risky fix for bug 30762. Revision ChangesPath 1.141 +4 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.140 retrieving revision 1.141 diff -u -r1.140 -r1.141 --- StandardContext.java 16 Aug 2004 09:31:06 - 1.140 +++ StandardContext.java 28 Aug 2004 13:54:16 - 1.141 @@ -4268,9 +4268,6 @@ ((Lifecycle) manager).stop(); } -// Stop our application listeners -listenerStop(); - // Finalize our character set mapper setCharsetMapper(null); @@ -4294,6 +4291,9 @@ if (children[i] instanceof Lifecycle) ((Lifecycle) children[i]).stop(); } + +// Stop our application listeners +listenerStop(); // Stop resources resourcesStop(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/07/30 00:32:36 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Add two missing events. Revision ChangesPath 1.139 +4 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.138 retrieving revision 1.139 diff -u -r1.138 -r1.139 --- StandardContext.java 29 Jul 2004 15:33:38 - 1.138 +++ StandardContext.java 30 Jul 2004 07:32:36 - 1.139 @@ -2262,6 +2262,7 @@ results[watchedResources.length] = name; watchedResources = results; } +fireContainerEvent("addWatchedResource", name); } @@ -3335,6 +3336,8 @@ watchedResources = results; } + +fireContainerEvent("removeWatchedResource", name); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardWrapper.java
remm2004/07/29 08:33:38 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java StandardWrapper.java Log: - Add support for JMX notifications in Context and Wrapper. This needs JMX 1.2. - Submitted by Peter Rossbach, bug 29869. Revision ChangesPath 1.138 +86 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.137 retrieving revision 1.138 diff -u -r1.137 -r1.138 --- StandardContext.java 26 Jul 2004 16:04:01 - 1.137 +++ StandardContext.java 29 Jul 2004 15:33:38 - 1.138 @@ -34,11 +34,16 @@ import java.util.Stack; import java.util.TreeMap; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanNotificationInfo; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.Notification; import javax.management.NotificationBroadcasterSupport; +import javax.management.NotificationEmitter; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; import javax.management.ObjectName; import javax.naming.NamingException; import javax.naming.directory.DirContext; @@ -104,7 +109,7 @@ public class StandardContext extends ContainerBase -implements Context, Serializable +implements Context, Serializable, NotificationEmitter { private static transient Log log = LogFactory.getLog(StandardContext.class); @@ -5120,6 +5125,85 @@ init(); } +/* Remove a JMX notficationListener + * @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) + */ +public void removeNotificationListener(NotificationListener listener, +NotificationFilter filter, Object object) throws ListenerNotFoundException { + broadcaster.removeNotificationListener(listener,filter,object); + +} + +private MBeanNotificationInfo[] notificationInfo; + +/* Get JMX Broadcaster Info + * @TODO use StringManager for international support! + * @TODO This two events we not send j2ee.state.failed and j2ee.attribute.changed! + * @see javax.management.NotificationBroadcaster#getNotificationInfo() + */ +public MBeanNotificationInfo[] getNotificationInfo() { + // FIXME: i18n + if(notificationInfo == null) { + notificationInfo = new MBeanNotificationInfo[]{ + new MBeanNotificationInfo(new String[] { + "j2ee.object.created"}, + Notification.class.getName(), + "web application is created" + ), + new MBeanNotificationInfo(new String[] { + "j2ee.state.starting"}, + Notification.class.getName(), + "change web application is starting" + ), + new MBeanNotificationInfo(new String[] { + "j2ee.state.running"}, + Notification.class.getName(), + "web application is running" + ), + new MBeanNotificationInfo(new String[] { + "j2ee.state.stopped"}, + Notification.class.getName(), + "web application start to stopped" + ), + new MBeanNotificationInfo(new String[] { + "j2ee.object.stopped"}, + Notification.class.getName(), + "web application is stopped" + ), + new MBeanNotificationInfo(new String[] { + "j2ee.object.deleted"}, + Notification.class.getName(), + "web application is deleted" + ) + }; + + } + + return notificationInfo; +} +
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/07/26 03:56:55 Modified:catalina/src/share/org/apache/catalina/startup HostConfig.java ContextConfig.java ExpandWar.java catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Add logic for avoiding locking on Windows. This takes a very heavy handed approach, but after trying many other methods, I think it's the only way to properly address the issue and allow real hot (re)deployment. - It's disabled by default, and there's a new antiResourceLocking attribute on Context. - I think I'll leave in the lighter anti JAR locking code in the CL, but disabled by default (and with another similar flag on Context). It could address different needs, and is less intrusive, as the webapp stays where it is. Revision ChangesPath 1.37 +38 -17 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java Index: HostConfig.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- HostConfig.java 26 Jul 2004 08:09:19 - 1.36 +++ HostConfig.java 26 Jul 2004 10:56:53 - 1.37 @@ -496,15 +496,25 @@ host.addChild(context); // Add the eventual unpacked WAR and all the resources which will be // watched inside it -if (isWar && unpackWARs && (context.getDocBase() != null)) { -File docBase = new File(context.getDocBase()); +if (isWar && unpackWARs) { +String name = null; +String path = context.getPath(); +if (path.equals("")) { +name = "ROOT"; +} else { +if (path.startsWith("/")) { +name = path.substring(1); +} else { +name = path; +} +} +File docBase = new File(name); if (!docBase.isAbsolute()) { -docBase = new File(new File(host.getAppBase()), -context.getDocBase()); +docBase = new File(new File(host.getAppBase()), name); } deployedApp.redeployResources.put(docBase.getAbsolutePath(), new Long(docBase.lastModified())); -addWatchedResources(deployedApp, context); +addWatchedResources(deployedApp, docBase.getAbsolutePath(), context); } } catch (Throwable t) { log.error(sm.getString("hostConfig.deployDescriptor.error", @@ -642,14 +652,24 @@ // If we're unpacking WARs, the docBase will be mutated after // starting the context if (unpackWARs && (context.getDocBase() != null)) { -File docBase = new File(context.getDocBase()); +String name = null; +String path = context.getPath(); +if (path.equals("")) { +name = "ROOT"; +} else { +if (path.startsWith("/")) { +name = path.substring(1); +} else { +name = path; +} +} +File docBase = new File(name); if (!docBase.isAbsolute()) { -docBase = new File(new File(host.getAppBase()), -context.getDocBase()); +docBase = new File(new File(host.getAppBase()), name); } deployedApp.redeployResources.put(docBase.getAbsolutePath(), new Long(docBase.lastModified())); -addWatchedResources(deployedApp, context); +addWatchedResources(deployedApp, docBase.getAbsolutePath(), context); } } catch (Throwable t) { log.error(sm.getString("hostConfig.deployJar.error", @@ -722,7 +742,7 @@ host.addChild(context); deployedApp.redeployResources.put(dir.getAbsolutePath(), new Long(dir.
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/06/24 15:09:52 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Small tweak to the logger name for the root context. Revision ChangesPath 1.133 +23 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.132 retrieving revision 1.133 diff -u -r1.132 -r1.133 --- StandardContext.java 24 Jun 2004 15:28:27 - 1.132 +++ StandardContext.java 24 Jun 2004 22:09:52 - 1.133 @@ -4715,6 +4715,28 @@ } +/** + * Return the abbreviated name of this container for logging messsages + */ +protected String logName() { + +if (logName != null) { +return logName; +} +String loggerName = ((getName() == null) || (getName().equals(""))) + ? "[/]" : ("[" + getName() + "]"); +Container current = getParent(); +while (current != null) { +loggerName = "[" + current.getName() + "]" ++ ((loggerName != null) ? ("." + loggerName) : ""); +current = current.getParent(); +} +logName = ContainerBase.class.getName() + "." + loggerName; +return logName; + +} + + // Private Methods - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java mbeans-descriptors.xml
remm2004/06/07 08:30:06 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java mbeans-descriptors.xml Log: - Add flag to disable save-context-file, which can be useful in embedded mode. Revision ChangesPath 1.130 +24 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.129 retrieving revision 1.130 diff -u -r1.129 -r1.130 --- StandardContext.java 26 May 2004 15:36:28 - 1.129 +++ StandardContext.java 7 Jun 2004 15:30:06 - 1.130 @@ -615,6 +615,12 @@ private boolean tldNamespaceAware = false; +/** + * Should we save the configuration. + */ +private boolean saveConfig = true; + + // - Context Properties public void setName( String name ) { @@ -1676,6 +1682,22 @@ } +/** + * Save config ? + */ +public boolean isSaveConfig() { +return saveConfig; +} + + +/** + * Set save config flag. + */ +public void setSaveConfig(boolean saveConfig) { +this.saveConfig = saveConfig; +} + + // Context Methods @@ -4047,7 +4069,7 @@ // Set config file name File configBase = getConfigBase(); -if (configBase != null) { +if ((configBase != null) && saveConfig) { if (getConfigFile() == null) { File file = new File(configBase, getDefaultConfigFile()); setConfigFile(file.getPath()); 1.29 +5 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml Index: mbeans-descriptors.xml === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- mbeans-descriptors.xml25 Feb 2004 21:08:07 - 1.28 +++ mbeans-descriptors.xml7 Jun 2004 15:30:06 - 1.29 @@ -256,6 +256,11 @@ type="[Ljava.lang.String;" writeable="false"/> + + - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
yoavs 2004/05/26 08:36:28 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Minor JavaDoc fixes (Bugzilla 11212) Revision ChangesPath 1.129 +12 -13 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.128 retrieving revision 1.129 diff -u -r1.128 -r1.129 --- StandardContext.java 25 Apr 2004 10:28:29 - 1.128 +++ StandardContext.java 26 May 2004 15:36:28 - 1.129 @@ -981,7 +981,7 @@ * * XXX If a file is not found - we can attempt a getResource() * - * @param defaultWebXml + * @param defaultWebXml The default web xml */ public void setDefaultWebXml(String defaultWebXml) { this.defaultWebXml = defaultWebXml; @@ -1508,7 +1508,7 @@ * and system.err will be redirected to the logger during a servlet * execution. * - * @param swallowOuptut The new value + * @param swallowOutput The new value */ public void setSwallowOutput(boolean swallowOutput) { @@ -1634,7 +1634,7 @@ /** Get the absolute path to the work dir. * To avoid duplication. * - * @return + * @return The work path */ public String getWorkPath() { File workDir = new File(getWorkDir()); @@ -5362,12 +5362,11 @@ * 1.The context is created and registered by internal APIS * 2. The context is created by JMX, and it'll self-register. * - * @param server - * @param name - * @return - * @throws Exception + * @param server The server + * @param name The object name + * @return ObjectName The name of the object + * @throws Exception If an error occurs */ - public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception @@ -5502,7 +5501,7 @@ /** * Set the validation feature of the XML parser used when * parsing xml instances. - * @param xmlValidation true to enable xml instance validation + * @param webXmlValidation true to enable xml instance validation */ public void setXmlValidation(boolean webXmlValidation){ @@ -5532,7 +5531,7 @@ /** * Set the namespace aware feature of the XML parser used when * parsing xml instances. - * @param xmlNamespaceAware true to enable namespace awareness + * @param webXmlNamespaceAware true to enable namespace awareness */ public void setXmlNamespaceAware(boolean webXmlNamespaceAware){ this.webXmlNamespaceAware= webXmlNamespaceAware; @@ -5542,7 +5541,7 @@ /** * Set the validation feature of the XML parser used when * parsing tlds files. - * @param tldXmlValidation true to enable xml instance validation + * @param tldValidation true to enable xml instance validation */ public void setTldValidation(boolean tldValidation){ @@ -5572,7 +5571,7 @@ /** * Set the namespace aware feature of the XML parser used when * parsing xml instances. - * @param xmlNamespaceAware true to enable namespace awareness + * @param tldNamespaceAware true to enable namespace awareness */ public void setTldNamespaceAware(boolean tldNamespaceAware){ this.tldNamespaceAware= tldNamespaceAware; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/04/25 03:28:29 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Experiment with stopping the manager earlier, so that listeners are still present. Revision ChangesPath 1.128 +7 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.127 retrieving revision 1.128 diff -u -r1.127 -r1.128 --- StandardContext.java 15 Apr 2004 01:44:08 - 1.127 +++ StandardContext.java 25 Apr 2004 10:28:29 - 1.128 @@ -4467,18 +4467,18 @@ // Stop our filters filterStop(); -// Stop our application listeners -listenerStop(); - -// Finalize our character set mapper -setCharsetMapper(null); - // Stop ContainerBackgroundProcessor thread super.threadStop(); if ((manager != null) && (manager instanceof Lifecycle)) { ((Lifecycle) manager).stop(); } + +// Stop our application listeners +listenerStop(); + +// Finalize our character set mapper +setCharsetMapper(null); // Normal container shutdown processing if (log.isDebugEnabled()) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java
Remy Maucherat wrote: (personally, I don't care about JDK 1.3 support anymore) I'll strongly ditto that -- Jess Holle - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java
Bill Barker wrote: luehe 2004/04/13 16:59:50 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java Log: Added support for exception chaining. Let me know if the call to Throwable.initCause(), which was added in J2SE 1.4, is a problem, and I'll comment it out. BTW, does someone really test TC 5 with JDK 1.3 ? (personally, I don't care about JDK 1.3 support anymore) Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 13, 2004 4:59 PM Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java > luehe 2004/04/13 16:59:50 > > Modified:catalina/src/share/org/apache/catalina/core > StandardContext.java StandardDefaultContext.java > Log: > Added support for exception chaining. > > Let me know if the call to Throwable.initCause(), which was added in J2SE 1.4, is a problem, and I'll comment it out. > Of course, I'd prefer to have this to be handled by o.a.t.u.compat.JdkCompat so that we can maintain JDK 1.3 support. However, I probably won't be able to get to it today myself :(. This message is intended only for the use of the person(s) listed above as the intended recipient(s), and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not an intended recipient, you may not read, copy, or distribute this message or any attachment. If you received this communication in error, please notify us immediately by e-mail and then delete all copies of this message and any attachments. In addition you should be aware that ordinary (unencrypted) e-mail sent through the Internet is not secure. Do not send confidential or sensitive information, such as social security numbers, account numbers, personal identification numbers and passwords, to us via ordinary (unencrypted) e-mail. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java
luehe 2004/04/13 16:59:50 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java Log: Added support for exception chaining. Let me know if the call to Throwable.initCause(), which was added in J2SE 1.4, is a problem, and I'll comment it out. Revision ChangesPath 1.126 +10 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.125 retrieving revision 1.126 diff -u -r1.125 -r1.126 --- StandardContext.java 7 Apr 2004 21:34:12 - 1.125 +++ StandardContext.java 13 Apr 2004 23:59:50 - 1.126 @@ -5064,8 +5064,10 @@ MBeanUtils.createObjectName(this.getEngineName(), envs[i]); results.add(oname.toString()); } catch (MalformedObjectNameException e) { -throw new IllegalArgumentException +IllegalArgumentException iae = new IllegalArgumentException ("Cannot create object name for environment " + envs[i]); +iae.initCause(e); +throw iae; } } return ((String[]) results.toArray(new String[results.size()])); @@ -5087,8 +5089,10 @@ MBeanUtils.createObjectName(this.getEngineName(), resources[i]); results.add(oname.toString()); } catch (MalformedObjectNameException e) { -throw new IllegalArgumentException +IllegalArgumentException iae = new IllegalArgumentException ("Cannot create object name for resource " + resources[i]); +iae.initCause(e); +throw iae; } } return ((String[]) results.toArray(new String[results.size()])); @@ -5110,8 +5114,10 @@ MBeanUtils.createObjectName(this.getEngineName(), links[i]); results.add(oname.toString()); } catch (MalformedObjectNameException e) { -throw new IllegalArgumentException +IllegalArgumentException iae = new IllegalArgumentException ("Cannot create object name for resource " + links[i]); +iae.initCause(e); +throw iae; } } return ((String[]) results.toArray(new String[results.size()])); 1.13 +14 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java Index: StandardDefaultContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- StandardDefaultContext.java 27 Feb 2004 14:58:42 - 1.12 +++ StandardDefaultContext.java 13 Apr 2004 23:59:50 - 1.13 @@ -1532,9 +1532,10 @@ } context.setLoader(context_loader); } catch(Exception e) { -throw new IllegalArgumentException - ("DefaultContext custom Loader install failed, Exception: " + - e.getMessage()); +IllegalArgumentException iae = new IllegalArgumentException + ("DefaultContext custom Loader install failed"); +iae.initCause(e); +throw iae; } } } @@ -1695,8 +1696,10 @@ MBeanUtils.createObjectName(this.getDomain(), envs[i]); results.add(oname.toString()); } catch (MalformedObjectNameException e) { -throw new IllegalArgumentException +IllegalArgumentException iae = new IllegalArgumentException ("Cannot create object name for environment " + envs[i]); +iae.initCause(e); +throw iae; } } return ((String[]) results.toArray(new String[results.size()])); @@ -1719,8 +1722,10 @@ MBeanUtils.createObjectName(getDomain(), resources[i]); results.add(oname.toString()); } catch (MalformedObjectNameException e) { -throw new IllegalArgumentException +IllegalArgumentException iae = new IllegalArgumentException ("Cannot create object name for resource " + resources[i]); +iae.initCause(e); +throw iae;
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Remy Maucherat wrote: [EMAIL PROTECTED] wrote: luehe 2004/04/07 14:34:12 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: When the webapp specific JspServlet inherits the mappings from the global JspServlet, we need to wipe out the wrapper corresponding to the global JspServlet from the mapper (by calling StandardContext.addServletMapping() instead of StandardWrapper.addMapping()) Are you absolutely certain all this stuff is really needed ? (I hope you're aware that adding a lot of these hacks is bad ;) ) Yes, I'm pretty positive, because I have some test cases. ;-) The latest change was prompted by a test case where inside a webapp that declares its own JspServlet, a JSP 's another JSP. However, the ApplicationDispatcher reported that the "Servlet jsp is currently unavailable", because the context's mapper still contained the wrapper corresponding to the old (global) JspServlet, which had been disabled. I promise I'm done. :) Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
[EMAIL PROTECTED] wrote: luehe 2004/04/07 14:34:12 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: When the webapp specific JspServlet inherits the mappings from the global JspServlet, we need to wipe out the wrapper corresponding to the global JspServlet from the mapper (by calling StandardContext.addServletMapping() instead of StandardWrapper.addMapping()) Are you absolutely certain all this stuff is really needed ? (I hope you're aware that adding a lot of these hacks is bad ;) ) Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2004/04/07 14:34:12 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: When the webapp specific JspServlet inherits the mappings from the global JspServlet, we need to wipe out the wrapper corresponding to the global JspServlet from the mapper (by calling StandardContext.addServletMapping() instead of StandardWrapper.addMapping()) Revision ChangesPath 1.125 +20 -14 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.124 retrieving revision 1.125 diff -u -r1.124 -r1.125 --- StandardContext.java 7 Apr 2004 02:27:47 - 1.124 +++ StandardContext.java 7 Apr 2004 21:34:12 - 1.125 @@ -1731,26 +1731,22 @@ */ public void addChild(Container child) { +// Global JspServlet +Wrapper oldJspServlet = null; + if (!(child instanceof Wrapper)) { throw new IllegalArgumentException (sm.getString("standardContext.notWrapper")); } Wrapper wrapper = (Wrapper) child; +boolean isJspServlet = "jsp".equals(child.getName()); -/* - * Allow webapp to override JspServlet inherited from global web.xml. - * The webapp-specific JspServlet inherits all the mappings specified - * in the global web.xml, and may add additional ones. - */ -if ("jsp".equals(wrapper.getName())) { -Wrapper jspServlet = (Wrapper) findChild("jsp"); -if (jspServlet != null) { -String[] jspMappings = jspServlet.findMappings(); -for (int i=0; jspMappings!=null && i
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
[For some reason, a commit notification was never sent for this change i committed last night] date: 2004/04/07 02:27:47; author: luehe; state: Exp; lines: +18 -18 Fixed problem where when replacing global JspServlet with webapp-specific one, the wrapper for the global JspServlet (which had already been stopped and marked unavailable) was still being registered with JMX, because even though the wrapper had been removed from the context's children, it was never removed from the "wrappers" instance field. Replaced all occurrences of "wrappers" with the result of "findChildren()", so that we don't need to maintain two lists of wrapper children. DIFFS: Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.123 retrieving revision 1.124 diff -u -r1.123 -r1.124 --- StandardContext.java5 Apr 2004 22:40:07 - 1.123 +++ StandardContext.java7 Apr 2004 02:27:47 - 1.124 @@ -109,7 +109,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.123 $ $Date: 2004/04/05 22:40:07 $ + * @version $Revision: 1.124 $ $Date: 2004/04/07 02:27:47 $ */ public class StandardContext @@ -569,8 +569,6 @@ */ private transient DirContext webappResources = null; -private ArrayList wrappers=new ArrayList(); - private long startupTime; private long startTime; private long tldScanTime; @@ -2315,7 +2313,6 @@ public Wrapper createWrapper() { //log.info( "Create wrapper" ); Wrapper wrapper = new StandardWrapper(); -wrappers.add(wrapper); synchronized (instanceListeners) { for (int i = 0; i < instanceListeners.length; i++) { @@ -3105,9 +3102,10 @@ */ public void removeChild(Container child) { -if (!(child instanceof Wrapper)) +if (!(child instanceof Wrapper)) { throw new IllegalArgumentException (sm.getString("standardContext.notWrapper")); +} super.removeChild(child); @@ -4416,8 +4414,6 @@ // Reset application context context = null; - -wrappers = new ArrayList(); } /** @@ -4523,8 +4519,6 @@ // Reset application context context = null; -wrappers = new ArrayList(); - // This object will no longer be visible or used. try { resetContext(); @@ -5251,16 +5245,23 @@ } -/** JSR77 servlets attribute +/** + * JSR77 servlets attribute * * @return list of all servlets ( we know about ) */ public String[] getServlets() { -int size=wrappers.size(); -String result[]=new String[size]; -for( int i=0; i< size; i++ ) { -result[i]=((StandardWrapper)wrappers.get(i)).getObjectName(); + +String[] result = null; + +Container[] children = findChildren(); +if (children != null) { +result = new String[children.length]; +for( int i=0; i< children.length; i++ ) { +result[i] = ((StandardWrapper)children[i]).getObjectName(); +} } + return result; } @@ -5325,10 +5326,9 @@ broadcaster.sendNotification(notification); } } -for (Iterator it = wrappers.iterator(); it.hasNext() ; ) { -StandardWrapper wrapper=(StandardWrapper)it.next(); -// XXX prevent duplicated registration -wrapper.registerJMX( this ); +Container children[] = findChildren(); +for (int i=0; children!=null && i Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2004/04/06 19:27:47 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fixed problem where when replacing global JspServlet with webapp-specific one, the wrapper for the global JspServlet (which had already been stopped and marked unavailable) was still being registered with JMX, because even though the wrapper had been removed from the context's children, it was never removed from the "wrappers" instance field. Replaced all occurrences of "wrappers" with the result of "findChildren()", so that we don't need to maintain two lists of wrapper children. Revision ChangesPath 1.124 +18 -18 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.123 retrieving revision 1.124 diff -u -r1.123 -r1.124 --- StandardContext.java 5 Apr 2004 22:40:07 - 1.123 +++ StandardContext.java 7 Apr 2004 02:27:47 - 1.124 @@ -569,8 +569,6 @@ */ private transient DirContext webappResources = null; -private ArrayList wrappers=new ArrayList(); - private long startupTime; private long startTime; private long tldScanTime; @@ -2315,7 +2313,6 @@ public Wrapper createWrapper() { //log.info( "Create wrapper" ); Wrapper wrapper = new StandardWrapper(); -wrappers.add(wrapper); synchronized (instanceListeners) { for (int i = 0; i < instanceListeners.length; i++) { @@ -3105,9 +3102,10 @@ */ public void removeChild(Container child) { -if (!(child instanceof Wrapper)) +if (!(child instanceof Wrapper)) { throw new IllegalArgumentException (sm.getString("standardContext.notWrapper")); +} super.removeChild(child); @@ -4416,8 +4414,6 @@ // Reset application context context = null; - -wrappers = new ArrayList(); } /** @@ -4523,8 +4519,6 @@ // Reset application context context = null; -wrappers = new ArrayList(); - // This object will no longer be visible or used. try { resetContext(); @@ -5251,16 +5245,23 @@ } -/** JSR77 servlets attribute +/** + * JSR77 servlets attribute * * @return list of all servlets ( we know about ) */ public String[] getServlets() { -int size=wrappers.size(); -String result[]=new String[size]; -for( int i=0; i< size; i++ ) { -result[i]=((StandardWrapper)wrappers.get(i)).getObjectName(); + +String[] result = null; + +Container[] children = findChildren(); +if (children != null) { +result = new String[children.length]; +for( int i=0; i< children.length; i++ ) { +result[i] = ((StandardWrapper)children[i]).getObjectName(); +} } + return result; } @@ -5325,10 +5326,9 @@ broadcaster.sendNotification(notification); } } -for (Iterator it = wrappers.iterator(); it.hasNext() ; ) { -StandardWrapper wrapper=(StandardWrapper)it.next(); -// XXX prevent duplicated registration -wrapper.registerJMX( this ); +Container children[] = findChildren(); +for (int i=0; children!=null && i
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2004/04/05 15:40:07 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Allow webapp to override JspServlet (settings) inherited from global web.xml Revision ChangesPath 1.123 +21 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- StandardContext.java 25 Mar 2004 22:31:46 - 1.122 +++ StandardContext.java 5 Apr 2004 22:40:07 - 1.123 @@ -1733,10 +1733,29 @@ */ public void addChild(Container child) { -if (!(child instanceof Wrapper)) +if (!(child instanceof Wrapper)) { throw new IllegalArgumentException (sm.getString("standardContext.notWrapper")); +} + Wrapper wrapper = (Wrapper) child; + +/* + * Allow webapp to override JspServlet inherited from global web.xml. + * The webapp-specific JspServlet inherits all the mappings specified + * in the global web.xml, and may add additional ones. + */ +if ("jsp".equals(wrapper.getName())) { +Wrapper jspServlet = (Wrapper) findChild("jsp"); +if (jspServlet != null) { +String[] jspMappings = jspServlet.findMappings(); +for (int i=0; jspMappings!=null && i
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/03/22 04:45:55 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - It is better to call after start a little bt earlier. The last patch was causing some regressions, and was not addressing the issue. Revision ChangesPath 1.120 +11 -13 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.119 retrieving revision 1.120 diff -u -r1.119 -r1.120 --- StandardContext.java 17 Mar 2004 00:11:30 - 1.119 +++ StandardContext.java 22 Mar 2004 12:45:55 - 1.120 @@ -4238,6 +4238,11 @@ postWelcomeFiles(); } +if (ok) { +// Notify our interested LifecycleListeners +lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); +} + // Configure and call application event listeners and filters if (ok) { if (!listenerStart()) { @@ -4252,6 +4257,11 @@ } } +// Load and initialize all "load on startup" servlets +if (ok) { +loadOnStartup(findChildren()); +} + // Unbinding thread unbindThread(oldCCL); @@ -4273,11 +4283,6 @@ // JMX registration registerJMX(); -if (ok) { -// Notify our interested LifecycleListeners -lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); -} - startTime=System.currentTimeMillis(); // Send j2ee.state.running notification @@ -4286,13 +4291,6 @@ new Notification("j2ee.state.running", this.getObjectName(), sequenceNumber++); broadcaster.sendNotification(notification); -} - -// Load and initialize all "load on startup" servlets -if (ok) { -oldCCL = bindThread(); -loadOnStartup(findChildren()); -unbindThread(oldCCL); } // Close all JARs right away to avoid always opening a peak number - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
markt 2004/03/16 16:11:30 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix bug 14228 - Load on startup servlets should be loaded after AFTER_START_EVENT (where environment entries are created). Revision ChangesPath 1.119 +8 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.118 retrieving revision 1.119 diff -u -r1.118 -r1.119 --- StandardContext.java 16 Mar 2004 22:18:35 - 1.118 +++ StandardContext.java 17 Mar 2004 00:11:30 - 1.119 @@ -4252,11 +4252,6 @@ } } -// Load and initialize all "load on startup" servlets -if (ok) { -loadOnStartup(findChildren()); -} - // Unbinding thread unbindThread(oldCCL); @@ -4291,6 +4286,13 @@ new Notification("j2ee.state.running", this.getObjectName(), sequenceNumber++); broadcaster.sendNotification(notification); +} + +// Load and initialize all "load on startup" servlets +if (ok) { +oldCCL = bindThread(); +loadOnStartup(findChildren()); +unbindThread(oldCCL); } // Close all JARs right away to avoid always opening a peak number - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2004/03/16 14:18:35 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix for Bugzilla 27664 ("Welcome files not found in combination with jsp-property-group") [cont.] Revision ChangesPath 1.118 +20 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.117 retrieving revision 1.118 diff -u -r1.117 -r1.118 --- StandardContext.java 27 Feb 2004 14:58:42 - 1.117 +++ StandardContext.java 16 Mar 2004 22:18:35 - 1.118 @@ -1939,7 +1939,7 @@ } if( findChild(servletName) != null) { -addServletMapping(pattern, servletName); +addServletMapping(pattern, servletName, true); } else { log.debug("Skiping " + pattern + " , no servlet " + servletName); } @@ -2130,7 +2130,24 @@ * is not known to this Context */ public void addServletMapping(String pattern, String name) { +addServletMapping(pattern, name, false); +} + +/** + * Add a new servlet mapping, replacing any existing mapping for + * the specified pattern. + * + * @param pattern URL pattern to be mapped + * @param name Name of the corresponding servlet to execute + * @param jspWildCard true if name identifies the JspServlet + * and pattern contains a wildcard; false otherwise + * + * @exception IllegalArgumentException if the specified servlet name + * is not known to this Context + */ +public void addServletMapping(String pattern, String name, + boolean jspWildCard) { // Validate the proposed mapping if (findChild(name) == null) throw new IllegalArgumentException @@ -2155,7 +2172,7 @@ wrapper.addMapping(pattern); // Update context mapper -mapper.addWrapper(pattern, wrapper); +mapper.addWrapper(pattern, wrapper, jspWildCard); fireContainerEvent("addServletMapping", pattern); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
jfarcand2004/02/04 09:49:14 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Revert my last commit. Revision ChangesPath 1.116 +1 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.115 retrieving revision 1.116 diff -u -r1.115 -r1.116 --- StandardContext.java 4 Feb 2004 17:28:28 - 1.115 +++ StandardContext.java 4 Feb 2004 17:49:14 - 1.116 @@ -4536,9 +4536,6 @@ // If you extend this - override this method and make sure to clean up children=new HashMap(); log.debug("resetContext " + oname + " " + mserver); -// Unregister the mbean so when ContainerBase.removeChild() is called -// the associated mbean is unregistered. -destroy(); } /** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Jeanfrancois Arcand wrote: Remy Maucherat wrote: [EMAIL PROTECTED] wrote: jfarcand2004/02/04 09:28:28 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: When using the embedded interface and calling removeChild(..), the mbean wasn't unregistered. That's only occurs when you call removeChild. The mbean is always unregistered when calling addChild (StandardContext.start()) That's not good. stop shouldn't remove the MBean, you'll have to call destroy elsewhere. If you create the Context through JMX, then you'd have no way to do further operations on it, since the MBean is gone. Yes, I've realized that after I've committed. I shoud think before committing. No, there's indeed bad stuff there (my unregister + register thingie in start() to be able to send the new welcome files to the mapper :-( I think this should be done with a notification instead, but it kinda works right now, so I never bothered doing it :) ). One register on init, one unregegister on destroy would be really good overall :) Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Remy Maucherat wrote: [EMAIL PROTECTED] wrote: jfarcand2004/02/04 09:28:28 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: When using the embedded interface and calling removeChild(..), the mbean wasn't unregistered. That's only occurs when you call removeChild. The mbean is always unregistered when calling addChild (StandardContext.start()) That's not good. stop shouldn't remove the MBean, you'll have to call destroy elsewhere. If you create the Context through JMX, then you'd have no way to do further operations on it, since the MBean is gone. Yes, I've realized that after I've committed. I shoud think before committing. -- Jeanfrancois Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
[EMAIL PROTECTED] wrote: jfarcand2004/02/04 09:28:28 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: When using the embedded interface and calling removeChild(..), the mbean wasn't unregistered. That's only occurs when you call removeChild. The mbean is always unregistered when calling addChild (StandardContext.start()) That's not good. stop shouldn't remove the MBean, you'll have to call destroy elsewhere. If you create the Context through JMX, then you'd have no way to do further operations on it, since the MBean is gone. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
jfarcand2004/02/04 09:28:28 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: When using the embedded interface and calling removeChild(..), the mbean wasn't unregistered. That's only occurs when you call removeChild. The mbean is always unregistered when calling addChild (StandardContext.start()) Revision ChangesPath 1.115 +4 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.114 retrieving revision 1.115 diff -u -r1.114 -r1.115 --- StandardContext.java 27 Jan 2004 23:18:19 - 1.114 +++ StandardContext.java 4 Feb 2004 17:28:28 - 1.115 @@ -4536,6 +4536,9 @@ // If you extend this - override this method and make sure to clean up children=new HashMap(); log.debug("resetContext " + oname + " " + mserver); +// Unregister the mbean so when ContainerBase.removeChild() is called +// the associated mbean is unregistered. +destroy(); } /** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/01/27 15:18:19 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Bug 26373: Initialize mapper before load on startup servlets. Revision ChangesPath 1.114 +4 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.113 retrieving revision 1.114 diff -u -r1.113 -r1.114 --- StandardContext.java 26 Jan 2004 20:19:10 - 1.113 +++ StandardContext.java 27 Jan 2004 23:18:19 - 1.114 @@ -4252,6 +4252,9 @@ getServletContext().setAttribute (Globals.RESOURCES_ATTR, getResources()); +// Initialize associated mapper +mapper.setContext(getPath(), welcomeFiles, resources); + // Binding thread oldCCL = bindThread(); @@ -4283,9 +4286,6 @@ // Unbinding thread unbindThread(oldCCL); - -// Initialize associated mapper -mapper.setContext(getPath(), welcomeFiles, resources); // Set available status depending upon startup success if (ok) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
luehe 2004/01/20 15:07:37 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fixed indentation Revision ChangesPath 1.109 +6 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- StandardContext.java 13 Jan 2004 17:01:48 - 1.108 +++ StandardContext.java 20 Jan 2004 23:07:36 - 1.109 @@ -1492,11 +1492,11 @@ public void setSessionTimeout(int timeout) { int oldSessionTimeout = this.sessionTimeout; -/* - * SRV.13.4 ("Deployment Descriptor"): - * If the timeout is 0 or less, the container ensures the default - * behaviour of sessions is never to time out. - */ +/* + * SRV.13.4 ("Deployment Descriptor"): + * If the timeout is 0 or less, the container ensures the default + * behaviour of sessions is never to time out. + */ this.sessionTimeout = (timeout == 0) ? -1 : timeout; support.firePropertyChange("sessionTimeout", new Integer(oldSessionTimeout), - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/01/13 09:01:48 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - In this case, we're in embedded mode, and dynamically creating a host (and it works !! thx Costin :) ), so using auto deployment is not a good idea (context restarts need to be controlled by the embedding software). Revision ChangesPath 1.108 +2 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.107 retrieving revision 1.108 diff -u -r1.107 -r1.108 --- StandardContext.java 13 Jan 2004 01:39:36 - 1.107 +++ StandardContext.java 13 Jan 2004 17:01:48 - 1.108 @@ -5340,6 +5340,7 @@ log.debug("No host, creating one " + parentName); StandardHost host=new StandardHost(); host.setName(hostName); +host.setAutoDeploy(false); Registry.getRegistry().registerComponent(host, parentName, null); mserver.invoke(parentName, "init", new Object[] {}, new String[] {} ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
fhanik 2004/01/12 17:39:36 Modified:catalina/src/share/org/apache/catalina Manager.java catalina/src/share/org/apache/catalina/core StandardContext.java Log: Added in the method backgroundProcess() to the manager interface. This allows any context to invoke the method on any custom manager and allow the manager to have a thread less back ground process, for example for expiring sessions. The CVS diffs should be cleaner now, had to fix my IDE. Revision ChangesPath 1.6 +12 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java Index: Manager.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Manager.java 12 Jan 2004 18:44:04 - 1.5 +++ Manager.java 13 Jan 2004 01:39:36 - 1.6 @@ -259,6 +259,14 @@ * @exception IOException if an input/output error occurs */ public void unload() throws IOException; + + /** + * This method will be invoked by the context/container on a periodic + * basis and allows the manager to implement + * a method that executes periodic tasks, such as expiring sessions etc. + */ + public void backgroundProcess(); + } 1.107 +5 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.106 retrieving revision 1.107 diff -u -r1.106 -r1.107 --- StandardContext.java 12 Jan 2004 18:44:04 - 1.106 +++ StandardContext.java 13 Jan 2004 01:39:36 - 1.107 @@ -4571,12 +4571,10 @@ count = (count + 1) % managerChecksFrequency; if ((getManager() != null) && (count == 0)) { -if (getManager() instanceof StandardManager) { -((StandardManager) getManager()).processExpires(); -} else if (getManager() instanceof PersistentManagerBase) { -PersistentManagerBase pManager = -(PersistentManagerBase) getManager(); -pManager.backgroundProcess(); +try { +getManager().backgroundProcess(); +} catch ( Exception x ) { +log.warn("Unable to perform background process on manager",x); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
fhanik 2004/01/12 10:44:05 Modified:catalina/src/share/org/apache/catalina Manager.java catalina/src/share/org/apache/catalina/core StandardContext.java Log: Rolled back changes to backgroundProcess Revision ChangesPath 1.5 +1 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java Index: Manager.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Manager.java 12 Jan 2004 05:21:48 - 1.4 +++ Manager.java 12 Jan 2004 18:44:04 - 1.5 @@ -186,7 +186,7 @@ * Get a session from the recycled ones or create a new empty one. * The PersistentManager manager does not need to create session data * because it reads it from the Store. - */ + */ public Session createEmptySession(); /** @@ -260,11 +260,5 @@ */ public void unload() throws IOException; -/** - * This method will be invoked by the context/container on a periodic - * basis and allows the manager to implement - * a method that executes periodic tasks, such as expiring sessions etc. - */ -public void backgroundProcess(); } 1.106 +124 -123 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.105 retrieving revision 1.106 diff -u -r1.105 -r1.106 --- StandardContext.java 12 Jan 2004 05:21:48 - 1.105 +++ StandardContext.java 12 Jan 2004 18:44:04 - 1.106 @@ -71,7 +71,6 @@ import java.io.InputStreamReader; import java.io.ObjectOutputStream; import java.io.Serializable; -import java.lang.reflect.Method; import java.net.URLDecoder; import java.util.ArrayList; import java.util.HashMap; @@ -207,14 +206,14 @@ /** * The set of instantiated application event listener objects. */ -private transient Object applicationEventListenersObjects[] = +private transient Object applicationEventListenersObjects[] = new Object[0]; /** * The set of instantiated application lifecycle listener objects. */ -private transient Object applicationLifecycleListenersObjects[] = +private transient Object applicationLifecycleListenersObjects[] = new Object[0]; @@ -229,12 +228,12 @@ * The application available flag for this Context. */ private boolean available = false; - + /** - * The broadcaster that sends j2ee notifications. + * The broadcaster that sends j2ee notifications. */ private NotificationBroadcasterSupport broadcaster = null; - + /** * The Locale to character set mapper for this application. */ @@ -304,7 +303,7 @@ private String displayName = null; -/** +/** * Override the default web xml location. ContextConfig is not configurable * so the setter is not used. */ @@ -374,7 +373,7 @@ /** * The mapper associated with this context. */ -private org.apache.tomcat.util.http.mapper.Mapper mapper = +private org.apache.tomcat.util.http.mapper.Mapper mapper = new org.apache.tomcat.util.http.mapper.Mapper(); @@ -492,7 +491,7 @@ * The notification sequence number. */ private long sequenceNumber = 0; - + /** * The status code error pages for this web application, keyed by * HTTP status code (as an Integer). @@ -623,7 +622,7 @@ private long tldScanTime; /** Name of the engine. If null, the domain is used. - */ + */ private String engineName = null; private String j2EEApplication="none"; private String j2EEServer="none"; @@ -1308,7 +1307,7 @@ } - + /** * Set the context path for this Context. * @@ -1646,9 +1645,9 @@ /** Get the absolute path to the work dir. * To avoid duplication. - * + * * @return - */ + */ public String getWorkPath() { File workDir = new File(getWorkDir()); if (!workDir.isAbsolute()) { @@ -1663,7 +1662,7 @@ } return workDir.getAbsolutePath(); } - + /** * Return the work directory for this Context. */
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2004/01/05 00:46:20 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Bug 25885: Incorrect test. - Submitted by Peter Rossbach. Revision ChangesPath 1.104 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.103 retrieving revision 1.104 diff -u -r1.103 -r1.104 --- StandardContext.java 17 Dec 2003 22:39:27 - 1.103 +++ StandardContext.java 5 Jan 2004 08:46:20 - 1.104 @@ -1726,7 +1726,7 @@ synchronized (applicationParameters) { String newName = parameter.getName(); for (int i = 0; i < applicationParameters.length; i++) { -if (name.equals(applicationParameters[i].getName()) && +if (newName.equals(applicationParameters[i].getName()) && !applicationParameters[i].getOverride()) return; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/12/17 14:39:27 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Set all common resources attributes on start (incl allowLinking). - Bug 25593. Revision ChangesPath 1.103 +13 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.102 retrieving revision 1.103 diff -u -r1.102 -r1.103 --- StandardContext.java 27 Nov 2003 00:37:29 - 1.102 +++ StandardContext.java 17 Dec 2003 22:39:27 - 1.103 @@ -3847,8 +3847,20 @@ try { ProxyDirContext proxyDirContext = new ProxyDirContext(env, webappResources); +if (webappResources instanceof FileDirContext) { +filesystemBased = true; +((FileDirContext) webappResources).setCaseSensitive +(isCaseSensitive()); +((FileDirContext) webappResources).setAllowLinking +(isAllowLinking()); +} if (webappResources instanceof BaseDirContext) { ((BaseDirContext) webappResources).setDocBase(getBasePath()); +((BaseDirContext) webappResources).setCached +(isCachingAllowed()); +((BaseDirContext) webappResources).setCacheTTL(getCacheTTL()); +((BaseDirContext) webappResources).setCacheMaxSize +(getCacheMaxSize()); ((BaseDirContext) webappResources).allocate(); } // Register the cache in JMX - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
[EMAIL PROTECTED] wrote: remm2003/11/26 13:34:04 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Calculating the object name should occur as early as possible, to fix a stop/start scenario based on different object instances. - This fixes bug 25033. I think I'll put together a new 5.0.16 build by this week-end, with voting on monday (it's not like any of the USA based folks are going to be around). This will also pick up the rather numerous docs updates, which can't hurt (please, more docs updates :) ). The changes so far are minimal, and won't require extensive additional testing. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/11/26 16:37:29 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Forgot to remove some of my debug code. Revision ChangesPath 1.102 +1 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- StandardContext.java 26 Nov 2003 21:34:04 - 1.101 +++ StandardContext.java 27 Nov 2003 00:37:29 - 1.102 @@ -5260,9 +5260,6 @@ } private void registerJMX() { -if (oname == null) { -return; -} try { if (log.isDebugEnabled()) { log.debug("Checking for " + oname ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/11/26 13:34:04 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Calculating the object name should occur as early as possible, to fix a stop/start scenario based on different object instances. - This fixes bug 25033. Revision ChangesPath 1.101 +7 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- StandardContext.java 13 Nov 2003 21:03:14 - 1.100 +++ StandardContext.java 26 Nov 2003 21:34:04 - 1.101 @@ -3985,6 +3985,9 @@ log.debug("Starting " + logName); +// Set JMX object name for proper pipeline registration +preRegisterJMX(); + if ((oname != null) && (Registry.getRegistry().getMBeanServer().isRegistered(oname))) { // As things depend on the JMX registration, the context @@ -4178,9 +4181,6 @@ if ((resources != null) && (resources instanceof Lifecycle)) ((Lifecycle) resources).start(); -// Set JMX object name for proper pipeline registration -preRegisterJMX(); - // Start our child containers, if any Container children[] = findChildren(); for (int i = 0; i < children.length; i++) { @@ -5260,6 +5260,9 @@ } private void registerJMX() { +if (oname == null) { +return; +} try { if (log.isDebugEnabled()) { log.debug("Checking for " + oname ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/11/13 00:30:35 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix registration of the root context through JMX (basically, it's the usual "/" -> "" conversion for the path). Revision ChangesPath 1.99 +7 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.98 retrieving revision 1.99 diff -u -r1.98 -r1.99 --- StandardContext.java 31 Oct 2003 21:45:25 - 1.98 +++ StandardContext.java 13 Nov 2003 08:30:35 - 1.99 @@ -5277,7 +5277,12 @@ hostName="localhost"; // Should be default... if( delim > 0 ) { hostName=path.substring(0, delim); -this.setName( path.substring(delim)); +path = path.substring(delim); +if (path.equals("/")) { +this.setName(""); +} else { +this.setName(path); +} } else { log.debug("Setting path " + path ); this.setName( path ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java StandardEngine.java StandardHost.java
glenn 2003/10/20 17:18:25 Modified:webapps/docs/config defaultcontext.xml catalina/src/share/org/apache/catalina/startup ContextRuleSet.java catalina/src/share/org/apache/catalina/core StandardContext.java StandardDefaultContext.java StandardEngine.java StandardHost.java Log: The DefaultContext docs listed support for a Listener but the code to suppor this was not implemented. Added support for nesting a Context Listener within a DefaultContext. Added support for nesting a Webapp Loader within a DefaultContext. The importDefaultContext() had to be split into two methods. The installDefaultContext() method was added. This is due to sequencing issues when instantiating a Context. Some things needed to occur earlier than when the importDefaultContext() is called. And some things needed to occur during the normal importDefaultContext(). No interfaces in org.apache.catalina were changed, though they could be in Tomcat 5 since there has not been a final release. Revision ChangesPath 1.4 +2 -2 jakarta-tomcat-catalina/webapps/docs/config/defaultcontext.xml Index: defaultcontext.xml === RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/config/defaultcontext.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- defaultcontext.xml15 Jan 2003 03:40:44 - 1.3 +++ defaultcontext.xml21 Oct 2003 00:18:25 - 1.4 @@ -115,7 +115,6 @@ - ---> 1.4 +9 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextRuleSet.java Index: ContextRuleSet.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextRuleSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ContextRuleSet.java 2 Sep 2003 21:22:00 - 1.3 +++ ContextRuleSet.java 21 Oct 2003 00:18:25 - 1.4 @@ -302,8 +302,11 @@ public void begin(Attributes attributes) throws Exception { // Look up the required parent class loader -Container container = (Container) digester.peek(); -ClassLoader parentClassLoader = container.getParentClassLoader(); +ClassLoader parentClassLoader = null; +Object ojb = digester.peek(); +if (ojb instanceof Container) { +parentClassLoader = ((Container)ojb).getParentClassLoader(); +} // Instantiate a new Loader implementation object String className = loaderClass; 1.97 +14 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- StandardContext.java 15 Oct 2003 17:24:16 - 1.96 +++ StandardContext.java 21 Oct 2003 00:18:25 - 1.97 @@ -3965,6 +3965,19 @@ ok = false; } } + +// Install DefaultContext configuration +if (!getOverride()) { +Container host = getParent(); +if (host instanceof StandardHost) { +((StandardHost)host).installDefaultContext(this); +Container engine = host.getParent(); +if( engine instanceof StandardEngine ) { +((StandardEngine)engine).installDefaultContext(this); +} +} +} + // Look for a realm - that may have been configured earlier. // If the realm is added after context - it'll set itself. if( realm == null ) { 1.7 +70 -8 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java Index: StandardDefaultContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardDefaultContext.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- StandardDefaultContext.java 2 Sep 2003 21:22:04 - 1.6 +++ StandardDefaultContext.java 21 Oct 2003 00:18:25 - 1.7 @@ -66,9 +66,12 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.lang.reflect.Constructor; import java.util.ArrayList; +import java.util.Enumera
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/09/23 02:07:37 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Don't save anything if config base doesn't exist. Revision ChangesPath 1.95 +4 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.94 retrieving revision 1.95 diff -u -r1.94 -r1.95 --- StandardContext.java 22 Sep 2003 19:32:04 - 1.94 +++ StandardContext.java 23 Sep 2003 09:07:37 - 1.95 @@ -4631,6 +4631,9 @@ private File getConfigBase() { File configBase = new File(System.getProperty("catalina.base"), "conf"); +if (!configBase.exists()) { +return null; +} Container container = this; Container host = null; Container engine = null; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/09/22 12:32:04 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Save the config file to the config base in situations where the context would not be persistent after a restart. - I don't think I broke anything. Let me know ... Revision ChangesPath 1.94 +102 -17 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- StandardContext.java 14 Sep 2003 12:19:42 - 1.93 +++ StandardContext.java 22 Sep 2003 19:32:04 - 1.94 @@ -64,6 +64,7 @@ import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -108,6 +109,8 @@ import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Loader; +import org.apache.catalina.Server; +import org.apache.catalina.ServerFactory; import org.apache.catalina.Wrapper; import org.apache.catalina.deploy.ApplicationParameter; import org.apache.catalina.deploy.ContextEjb; @@ -3903,16 +3906,43 @@ // Set config file name File configBase = getConfigBase(); -if ((getConfigFile() == null) && (configBase != null)) { -String name = getName(); -if (name.equals("")) { -name = "ROOT"; -} -if (name.startsWith("/")) { -name = name.substring(1); +if (configBase != null) { +if (getConfigFile() == null) { +File file = new File(configBase, getDefaultConfigFile()); +setConfigFile(file.getPath()); +// If the docbase is outside the appBase, we should save our +// config +try { +File appBaseFile = new File(getAppBase()); +if (!appBaseFile.isAbsolute()) { +appBaseFile = new File(engineBase(), getAppBase()); +} +String appBase = appBaseFile.getCanonicalPath(); +String basePath = +(new File(getBasePath())).getCanonicalPath(); +if (!basePath.startsWith(appBase)) { +Server server = ServerFactory.getServer(); +((StandardServer) server).storeContext(this); +} +} catch (Exception e) { +log.warn("Error storing config file", e); +} +} else { +try { +String canConfigFile = +(new File(getConfigFile())).getCanonicalPath(); +if (!canConfigFile.startsWith +(configBase.getCanonicalPath())) { +File file = +new File(configBase, getDefaultConfigFile()); +if (copy(new File(canConfigFile), file)) { +setConfigFile(file.getPath()); +} +} +} catch (Exception e) { +log.warn("Error setting config file", e); +} } -File file = new File(configBase, name.replace('/', '_') + ".xml"); -setConfigFile(file.getPath()); } // Add missing components as necessary @@ -4558,20 +4588,20 @@ break; container = container.getParent(); } -if (container == null) { -docBase = (new File(engineBase(), getDocBase())).getPath(); -} else { -File file = new File(getDocBase()); -if (!file.isAbsolute()) { +File file = new File(getDocBase()); +if (!file.isAbsolute()) { +if (container == null) { +docBase = (new File(engineBase(), getDocBase())).getPath(); +} else { // Use the "appBase" property of this container String appBase = ((Host) container).getAppBase(); file = new File(appBase); if (!file.isAbsolute()) file = new File(engineBase(), appBase); docBase = (new File(file, getDocBase())).getPath(); -} else { -docBase = file.getPath(); } +} else { +docBase = file.ge
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/09/14 05:19:42 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Remove bad import. Revision ChangesPath 1.93 +1 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- StandardContext.java 13 Sep 2003 17:12:45 - 1.92 +++ StandardContext.java 14 Sep 2003 12:19:42 - 1.93 @@ -129,7 +129,6 @@ import org.apache.catalina.mbeans.MBeanUtils; import org.apache.catalina.session.PersistentManagerBase; import org.apache.catalina.session.StandardManager; -import org.apache.catalina.session.StoreBase; import org.apache.catalina.startup.ContextConfig; import org.apache.catalina.startup.TldConfig; import org.apache.catalina.util.CharsetMapper; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/09/12 07:07:30 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Oops, the context classloader binding is wrong, which does not allow a reload (bug 23131). Revision ChangesPath 1.91 +11 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- StandardContext.java 9 Sep 2003 15:27:00 - 1.90 +++ StandardContext.java 12 Sep 2003 14:07:30 - 1.91 @@ -4380,7 +4380,16 @@ if (getLoader() != null) { if (reloadable && (getLoader().modified())) { -reload(); +try { +Thread.currentThread().setContextClassLoader +(StandardContext.class.getClassLoader()); +reload(); +} finally { +if (getLoader() != null) { +Thread.currentThread().setContextClassLoader +(getLoader().getClassLoader()); +} +} } if (getLoader() instanceof WebappLoader) { ((WebappLoader) getLoader()).closeJARs(false); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/08/31 08:51:14 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Add an unpackWAR field to allow saving the attribute to the XML. Revision ChangesPath 1.87 +26 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- StandardContext.java 21 Aug 2003 04:17:06 - 1.86 +++ StandardContext.java 31 Aug 2003 15:51:14 - 1.87 @@ -418,6 +418,12 @@ /** + * Unpack WAR property. + */ +private boolean unpackWAR = true; + + +/** * The DefaultContext override flag for this web application. */ private boolean override = false; @@ -1394,6 +1400,25 @@ } + +/** + * Unpack WAR flag accessor. + */ +public boolean getUnpackWAR() { + +return (unpackWAR); + +} + + +/** + * Unpack WAR flag mutator. + */ +public void setUnpackWAR(boolean unpackWAR) { + +this.unpackWAR = unpackWAR; + +} /** * Return the Java class name of the Wrapper implementation used - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/08/20 21:17:06 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Ensure uniqueness of patters across all servlets, so that the mapper doesn't become a mess. - This should fix Jean-Francois' problem. Revision ChangesPath 1.86 +8 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.85 retrieving revision 1.86 diff -u -r1.85 -r1.86 --- StandardContext.java 20 Aug 2003 08:24:22 - 1.85 +++ StandardContext.java 21 Aug 2003 04:17:06 - 1.86 @@ -2027,6 +2027,13 @@ // Add this mapping to our registered set synchronized (servletMappings) { +String name2 = (String) servletMappings.get(pattern); +if (name2 != null) { +// Don't allow more than one servlet on the same pattern +Wrapper wrapper = (Wrapper) findChild(name2); +wrapper.removeMapping(pattern); +mapper.removeWrapper(pattern); +} servletMappings.put(pattern, name); } Wrapper wrapper = (Wrapper) findChild(name); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/08/20 01:24:23 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Manager checks should be a lot less frequent than the eventual reloader check, or the other container's checks. The current settings would have caused too much strain on the store. - Add a variable to configure the check interval. - Call the persistent manager checks. Revision ChangesPath 1.85 +54 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.84 retrieving revision 1.85 diff -u -r1.84 -r1.85 --- StandardContext.java 19 Aug 2003 17:11:49 - 1.84 +++ StandardContext.java 20 Aug 2003 08:24:22 - 1.85 @@ -541,6 +541,21 @@ /** + * Frequency of the session expiration, and related manager operations. + * Manager operations will be done once for the specified amount of + * backgrondProcess calls (ie, the lower the amount, the most often the + * checks will occur). + */ +private int managerChecksFrequency = 6; + + +/** + * Iteration count for background processing. + */ +private int count = 0; + + +/** * Caching allowed flag. */ private boolean cachingAllowed = true; @@ -688,7 +703,8 @@ new Boolean(this.available)); } - + + /** * Return the Locale to character set mapper for this Context. */ @@ -975,6 +991,37 @@ this.lazy = lazy; } + +/** + * Return the frequency of manager checks. + */ +public int getManagerChecksFrequency() { + +return (this.managerChecksFrequency); + +} + + +/** + * Set the manager checks frequency. + * + * @param managerChecksFrequency the new manager checks frequency + */ +public void setManagerChecksFrequency(int managerChecksFrequency) { + +if (managerChecksFrequency <= 0) { +return; +} + +int oldManagerChecksFrequency = this.managerChecksFrequency; +this.managerChecksFrequency = managerChecksFrequency; +support.firePropertyChange("managerChecksFrequency", + new Integer(oldManagerChecksFrequency), + new Integer(this.managerChecksFrequency)); + +} + + /** * Return descriptive information about this Container implementation and * the corresponding version number, in the format @@ -4302,12 +4349,16 @@ if (!started) return; -if (getManager() != null) { +count = (count + 1) % managerChecksFrequency; + +if ((getManager() != null) && (count == 0)) { if (getManager() instanceof StandardManager) { ((StandardManager) getManager()).processExpires(); } else if (getManager() instanceof PersistentManagerBase) { PersistentManagerBase pManager = (PersistentManagerBase) getManager(); +pManager.processExpires(); +pManager.processPersistenceChecks(); if ((pManager.getStore() != null) && (pManager.getStore() instanceof StoreBase)) { ((StoreBase) pManager.getStore()).processExpires(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/08/09 12:54:47 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix tests failures. - Fix array init. Revision ChangesPath 1.81 +5 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- StandardContext.java 9 Aug 2003 19:04:29 - 1.80 +++ StandardContext.java 9 Aug 2003 19:54:47 - 1.81 @@ -646,7 +646,7 @@ * this application has started, or after it has been stopped */ public Object[] getApplicationLifecycleListeners() { -return (applicationEventListenersObjects); +return (applicationLifecycleListenersObjects); } @@ -658,7 +658,7 @@ * @param listeners The set of instantiated listener objects. */ public void setApplicationLifecycleListeners(Object listeners[]) { -applicationEventListenersObjects = listeners; +applicationLifecycleListenersObjects = listeners; } @@ -3523,7 +3523,8 @@ for (int i = 0; i < results.length; i++) { if ((results[i] instanceof ServletContextAttributeListener) || (results[i] instanceof ServletRequestAttributeListener) -|| (results[i] instanceof ServletRequestListener)) { +|| (results[i] instanceof ServletRequestListener) +|| (results[i] instanceof HttpSessionAttributeListener)) { eventListeners.add(results[i]); } if ((results[i] instanceof ServletContextListener) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/08/10 02:47:33 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix bug where welcome files were not being processed in the embedded distribution. This was caused by the fact that the context is already registered in JMX, while being not initialized yet. The context will be unregistered if already registered while not being started yet. Revision ChangesPath 1.82 +13 -9 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- StandardContext.java 9 Aug 2003 19:54:47 - 1.81 +++ StandardContext.java 10 Aug 2003 09:47:33 - 1.82 @@ -3762,18 +3762,22 @@ } } -String logName="tomcat." + getParent().getName() + "." + -("".equals(getName()) ? "ROOT" : getName()) + ".Context"; -log=org.apache.commons.logging.LogFactory.getLog(logName); +String logName = "tomcat." + getParent().getName() + "." + +("".equals(getName()) ? "ROOT" : getName()) + ".Context"; +log = org.apache.commons.logging.LogFactory.getLog(logName); -//if (log.isDebugEnabled()) -log.debug("Starting " + logName); +log.debug("Starting " + logName); + +if ((oname != null) && +(Registry.getRegistry().getMBeanServer().isRegistered(oname))) { +// As things depend on the JMX registration, the context +// must be reregistered again once properly initialized +Registry.getRegistry().unregisterComponent(oname); +} // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null); -if (log.isDebugEnabled()) -log.debug("Processing start(), current available=" + getAvailable()); setAvailable(false); setConfigured(false); boolean ok = true; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/08/02 10:42:59 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Some steps of startup shouldn't be executed if the context startup has previously encountered errors. Revision ChangesPath 1.79 +9 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.78 retrieving revision 1.79 diff -u -r1.78 -r1.79 --- StandardContext.java 1 Aug 2003 06:14:40 - 1.78 +++ StandardContext.java 2 Aug 2003 17:42:59 - 1.79 @@ -3823,12 +3823,12 @@ dependencyCheck = validator.validateApplication(getResources(), this); } catch (IOException ioe) { +log.error("Error in dependencyCheck", ioe); dependencyCheck = false; } if (!dependencyCheck) { // do not make application available if depency check fails -log.error( "Error in dependencyCheck"); ok = false; } @@ -3981,15 +3981,17 @@ } // JMX registration -registerJMX(); +if (ok) { +registerJMX(); -// Notify our interested LifecycleListeners -lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); -startTime=System.currentTimeMillis(); +// Notify our interested LifecycleListeners +lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); +} +startTime=System.currentTimeMillis(); // Send j2ee.state.running notification -if (this.getObjectName() != null) { +if (ok && (this.getObjectName() != null)) { Notification notification = new Notification("j2ee.state.running", this.getObjectName(), sequenceNumber++); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/07/31 23:14:40 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Remove (for now) dead reload code. Revision ChangesPath 1.78 +1 -148 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.77 retrieving revision 1.78 diff -u -r1.77 -r1.78 --- StandardContext.java 31 Jul 2003 20:56:25 - 1.77 +++ StandardContext.java 1 Aug 2003 06:14:40 - 1.78 @@ -2744,153 +2744,6 @@ setPaused(false); -if (true) -return; - -// Binding thread -ClassLoader oldCCL = bindThread(); - -// Shut down our session manager -if ((manager != null) && (manager instanceof Lifecycle)) { -try { -((Lifecycle) manager).stop(); -} catch (LifecycleException e) { -log.error(sm.getString("standardContext.stoppingManager"), e); -} -} - -// Shut down the current version of all active servlets -Container children[] = findChildren(); -for (int i = 0; i < children.length; i++) { -Wrapper wrapper = (Wrapper) children[i]; -if (wrapper instanceof Lifecycle) { -try { -((Lifecycle) wrapper).stop(); -} catch (LifecycleException e) { -log.error(sm.getString("standardContext.stoppingWrapper", - wrapper.getName()), -e); -} -} -} - -// Shut down application event listeners -listenerStop(); - -// Clear all application-originated servlet context attributes -if (context != null) -context.clearAttributes(); - -// Shut down filters -filterStop(); - -if (isUseNaming()) { -// Start -namingContextListener.lifecycleEvent -(new LifecycleEvent(this, Lifecycle.STOP_EVENT)); -} - -// Binding thread -unbindThread(oldCCL); - -// Shut down our application class loader -if ((loader != null) && (loader instanceof Lifecycle)) { -try { -((Lifecycle) loader).stop(); -} catch (LifecycleException e) { -log.error(sm.getString("standardContext.stoppingLoader"), e); -} -} - -// Binding thread -oldCCL = bindThread(); - -// Restart our application class loader -if ((loader != null) && (loader instanceof Lifecycle)) { -try { -((Lifecycle) loader).start(); -} catch (LifecycleException e) { -log.error(sm.getString("standardContext.startingLoader"), e); -} -} - -// Binding thread -unbindThread(oldCCL); - -// Create and register the associated naming context, if internal -// naming is used -boolean ok = true; -if (isUseNaming()) { -// Start -namingContextListener.lifecycleEvent -(new LifecycleEvent(this, Lifecycle.START_EVENT)); -} - -// Binding thread -oldCCL = bindThread(); - -// Restart our application event listeners and filters -if (ok) { -if (!listenerStart()) { -log.error(sm.getString("standardContext.listenerStartFailed")); -ok = false; -} -} -if (ok) { -if (!filterStart()) { -log.error(sm.getString("standardContext.filterStartFailed")); -ok = false; -} -} - -// Restore the "Welcome Files" and "Resources" context attributes -postResources(); -postWelcomeFiles(); - -// Restart our currently defined servlets -for (int i = 0; i < children.length; i++) { -if (!ok) -break; -Wrapper wrapper = (Wrapper) children[i]; -if (wrapper instanceof Lifecycle) { -try { -((Lifecycle) wrapper).start(); -} catch (LifecycleException e) { -log.error(sm.getString("standardContext.startingWrapper", - wrapper.getName()), -e); -ok = false; -} -} -} -
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardWrapper.java
amyroh 2003/07/29 08:55:15 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java StandardWrapper.java Log: Fix the obvious typos. Revision ChangesPath 1.76 +3 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- StandardContext.java 29 Jul 2003 00:09:42 - 1.75 +++ StandardContext.java 29 Jul 2003 15:55:15 - 1.76 @@ -4218,10 +4218,10 @@ // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null); -// Send j2ee.state.stoping notification +// Send j2ee.state.stopping notification if (this.getObjectName() != null) { Notification notification = -new Notification("j2ee.state.stoping", this.getObjectName(), +new Notification("j2ee.state.stopping", this.getObjectName(), sequenceNumber++); broadcaster.sendNotification(notification); } 1.31 +7 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java Index: StandardWrapper.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- StandardWrapper.java 29 Jul 2003 00:09:42 - 1.30 +++ StandardWrapper.java 29 Jul 2003 15:55:15 - 1.31 @@ -1567,10 +1567,10 @@ setAvailable(Long.MAX_VALUE); -// Send j2ee.state.stoping notification +// Send j2ee.state.stopping notification if (this.getObjectName() != null) { Notification notification = -new Notification("j2ee.state.stoping", this.getObjectName(), +new Notification("j2ee.state.stopping", this.getObjectName(), sequenceNumber++); broadcaster.sendNotification(notification); } @@ -1586,7 +1586,7 @@ // Shut down this component super.stop(); -// Send j2ee.state.stopped notification +// Send j2ee.state.stoppped notification if (this.getObjectName() != null) { Notification notification = new Notification("j2ee.state.stopped", this.getObjectName(), - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardHost.java StandardWrapperValve.java mbeans-descriptors.xml
luehe 2003/07/22 14:01:27 Modified:catalina/src/share/org/apache/catalina Context.java Host.java catalina/src/share/org/apache/catalina/core StandardContext.java StandardHost.java StandardWrapperValve.java mbeans-descriptors.xml Log: Moved X-Powered-By property for servlets from Host/Context to CoyoteConnector. If property is set to TRUE, CoyoteAdapter adds X-Powered-By response header with value "Servlet/2,4". Turned X-Powered-By property for JSPs into a configurable Jasper compilation option. If set to TRUE, the generated servlet will add X-Powered-By response header with value "JSP/2.0". Revision ChangesPath 1.8 +4 -27 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java Index: Context.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Context.java 21 Jul 2003 19:05:50 - 1.7 +++ Context.java 22 Jul 2003 21:01:26 - 1.8 @@ -427,29 +427,6 @@ public void setWrapperClass(String wrapperClass); -/** - * Indicates whether the generation of an X-Powered-By response header for - * servlet-generated responses is enabled or disabled for this Context. - * - * Unless explicitly set on this Context, this method returns the - * X-Powered-By setting of the Host with which this Context is associated. - * - * @return true if generation of X-Powered-By response header is enabled, - * false otherwise - */ -public boolean isXpoweredBy(); - - -/** - * Enables or disables the generation of an X-Powered-By header (with value - * Servlet/2.4) for all servlet-generated responses from this Context. - * - * @param xpoweredBy true if generation of X-Powered-By response header is - * to be enabled, false otherwise - */ -public void setXpoweredBy(boolean xpoweredBy); - - // - Public Methods 1.6 +4 -25 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Host.java Index: Host.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Host.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Host.java 21 Jul 2003 19:05:50 - 1.5 +++ Host.java 22 Jul 2003 21:01:26 - 1.6 @@ -227,27 +227,6 @@ public void setXmlNamespaceAware(boolean xmlNamespaceAware); -/** - * Indicates whether the generation of an X-Powered-By response header for - * servlet-generated responses is enabled or disabled for this Host. - * - * @return true if generation of X-Powered-By response header is enabled, - * false otherwise - */ -public boolean isXpoweredBy(); - - -/** - * Enables or disables the generation of an X-Powered-By header (with value - * Servlet/2.4) for all servlet-generated responses from contexts - * registered with this Host. - * - * @param xpoweredBy true if generation of X-Powered-By response header is - * to be enabled, false otherwise - */ -public void setXpoweredBy(boolean xpoweredBy); - - // - Public Methods 1.74 +1 -57 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.73 retrieving revision 1.74 diff -u -r1.73 -r1.74 --- StandardContext.java 22 Jul 2003 18:51:21 - 1.73 +++ StandardContext.java 22 Jul 2003 21:01:26 - 1.74 @@ -276,18 +276,6 @@ private boolean distributable = false; -/* - * Enables/disables generation of X-Powered-By response header - */ -private boolean xpoweredBy; - - -/* - * Indicates whether setter for X-Powered-By property was explicitly called - */ -private boolean xpoweredBySetterCalled; - - /** * The document root for this web application. */ @@ -4364,50 +4352,6 @@ } } -} - - -/** - * Indicates whether the generation of an X-Powered-By response header for - * servlet-generated responses is enabled or disabled for this Context. - * - * Unles
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardHost.java StandardWrapperValve.java mbeans-descriptors.xml
luehe 2003/07/21 12:05:51 Modified:catalina/src/share/org/apache/catalina Context.java Host.java catalina/src/share/org/apache/catalina/core StandardContext.java StandardHost.java StandardWrapperValve.java mbeans-descriptors.xml Log: Added support for X-Powered-By response header, as defined by the Servlet 2.4 and JSP 2.0 specs. The Servlet 2.4 spec defines a special X-Powered-By: Servlet/2.4 header, which containers may add to servlet-generated responses. This is complemented by the JSP 2.0 spec, which defines a X-Powered-By: JSP/2.0 header to be added (on an optional basis) to responses utilizing JSP technology. The goal of these headers is to aid in gathering statistical data about the use of Servlet and JSP technology Revision ChangesPath 1.7 +27 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java Index: Context.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Context.java 19 May 2003 21:56:28 - 1.6 +++ Context.java 21 Jul 2003 19:05:50 - 1.7 @@ -427,6 +427,29 @@ public void setWrapperClass(String wrapperClass); +/** + * Indicates whether the generation of an X-Powered-By response header for + * servlet-generated responses is enabled or disabled for this Context. + * + * Unless explicitly set on this Context, this method returns the + * X-Powered-By setting of the Host with which this Context is associated. + * + * @return true if generation of X-Powered-By response header is enabled, + * false otherwise + */ +public boolean isXpoweredBy(); + + +/** + * Enables or disables the generation of an X-Powered-By header (with value + * Servlet/2.4) for all servlet-generated responses from this Context. + * + * @param xpoweredBy true if generation of X-Powered-By response header is + * to be enabled, false otherwise + */ +public void setXpoweredBy(boolean xpoweredBy); + + // - Public Methods 1.5 +25 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Host.java Index: Host.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Host.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Host.java 15 Jun 2003 13:03:11 - 1.4 +++ Host.java 21 Jul 2003 19:05:50 - 1.5 @@ -227,6 +227,27 @@ public void setXmlNamespaceAware(boolean xmlNamespaceAware); +/** + * Indicates whether the generation of an X-Powered-By response header for + * servlet-generated responses is enabled or disabled for this Host. + * + * @return true if generation of X-Powered-By response header is enabled, + * false otherwise + */ +public boolean isXpoweredBy(); + + +/** + * Enables or disables the generation of an X-Powered-By header (with value + * Servlet/2.4) for all servlet-generated responses from contexts + * registered with this Host. + * + * @param xpoweredBy true if generation of X-Powered-By response header is + * to be enabled, false otherwise + */ +public void setXpoweredBy(boolean xpoweredBy); + + // - Public Methods 1.72 +57 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- StandardContext.java 20 Jul 2003 14:52:17 - 1.71 +++ StandardContext.java 21 Jul 2003 19:05:50 - 1.72 @@ -276,6 +276,18 @@ private boolean distributable = false; +/* + * Enables/disables generation of X-Powered-By response header + */ +private boolean xpoweredBy; + + +/* + * Indicates whether setter for X-Powered-By property was explicitly called + */ +private boolean xpoweredBySetterCalled; + + /** * The document root for this web application. */ @@ -1600,7 +1612,6 @@ * @param errorPage The error page definition to be added */ publi
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/07/20 07:52:17 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Correctly update the mapper. The previous code was not compatible with the invoker servlet and its dynamically added wrappers. Revision ChangesPath 1.71 +7 -22 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- StandardContext.java 14 Jul 2003 10:54:11 - 1.70 +++ StandardContext.java 20 Jul 2003 14:52:17 - 1.71 @@ -1938,6 +1938,10 @@ } Wrapper wrapper = (Wrapper) findChild(name); wrapper.addMapping(pattern); + +// Update context mapper +mapper.addWrapper(pattern, wrapper); + fireContainerEvent("addServletMapping", pattern); } @@ -3373,6 +3377,7 @@ if( wrapper != null ) { wrapper.removeMapping(pattern); } +mapper.removeWrapper(pattern); fireContainerEvent("removeServletMapping", pattern); } @@ -4039,16 +4044,6 @@ // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(START_EVENT, null); -children = findChildren(); -for (int i = 0; i < children.length; i++) { -// Updating associated mapper -Wrapper wrapper = (Wrapper) children[i]; -String[] mappings = wrapper.findMappings(); -for (int j = 0; j < mappings.length; j++) { -mapper.addWrapper(mappings[j], wrapper); -} -} - if ((manager != null) && (manager instanceof Lifecycle)) { ((Lifecycle) manager).start(); } @@ -4235,16 +4230,6 @@ ((Lifecycle) manager).stop(); } -// Updating associated mapper -Container children[] = findChildren(); -for (int i = 0; i < children.length; i++) { -Wrapper wrapper = (Wrapper) children[i]; -String[] mappings = wrapper.findMappings(); -for (int j = 0; j < mappings.length; j++) { -mapper.removeWrapper(mappings[j]); -} -} - // Normal container shutdown processing if (log.isDebugEnabled()) log.debug("Processing standard container shutdown"); @@ -4260,7 +4245,7 @@ } // Stop our child containers, if any -children = findChildren(); +Container[] children = findChildren(); for (int i = 0; i < children.length; i++) { if (children[i] instanceof Lifecycle) ((Lifecycle) children[i]).stop(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/07/14 03:54:11 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Strip out leading '/' for the context file name, for cosmetic reasons. Revision ChangesPath 1.70 +4 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- StandardContext.java 2 Jul 2003 22:00:34 - 1.69 +++ StandardContext.java 14 Jul 2003 10:54:11 - 1.70 @@ -3867,6 +3867,9 @@ if (name.equals("")) { name = "ROOT"; } +if (name.startsWith("/")) { +name = name.substring(1); +} File file = new File(configBase, name.replace('/', '_') + ".xml"); setConfigFile(file.getPath()); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/07/02 15:00:39 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Small code cleanup. - Initialize mapper after the main start so that welcome files are correctly set. Revision ChangesPath 1.69 +13 -10 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- StandardContext.java 24 Jun 2003 21:36:49 - 1.68 +++ StandardContext.java 2 Jul 2003 22:00:34 - 1.69 @@ -4007,9 +4007,6 @@ if ((resources != null) && (resources instanceof Lifecycle)) ((Lifecycle) resources).start(); -// Initialize associated mapper -mapper.setContext(getPath(), welcomeFiles, resources); - // Set JMX object name for proper pipeline registration preRegisterJMX(); @@ -4026,12 +4023,13 @@ ((Lifecycle) pipeline).start(); // Read tldListeners. XXX Option to disable -TldConfig tldConfig=new TldConfig(); -tldConfig.setContext( this ); +TldConfig tldConfig = new TldConfig(); +tldConfig.setContext(this); try { tldConfig.execute(); -} catch( Exception ex ) { -log.error("Error reading tld listeners " + ex.toString(), ex); +} catch (Exception ex) { +log.error("Error reading tld listeners " + + ex.toString(), ex); //ok=false; } @@ -4096,16 +4094,21 @@ // Create request listener lifecycle valve if (ok) { if (!requestListenerConfig()) { - log.error(sm.getString("standardContext.requestListenerStartFailed")); +log.error(sm.getString + ("standardContext.requestListenerStartFailed")); } } // Load and initialize all "load on startup" servlets -if (ok) +if (ok) { loadOnStartup(findChildren()); +} // Unbinding thread unbindThread(oldCCL); + +// Initialize associated mapper +mapper.setContext(getPath(), welcomeFiles, resources); // Set available status depending upon startup success if (ok) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/06/24 14:36:49 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Escape '/' in the configFile name. Revision ChangesPath 1.68 +2 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- StandardContext.java 22 Jun 2003 17:14:24 - 1.67 +++ StandardContext.java 24 Jun 2003 21:36:49 - 1.68 @@ -3863,17 +3863,12 @@ // Set config file name File configBase = getConfigBase(); if ((getConfigFile() == null) && (configBase != null)) { - String name = getName(); if (name.equals("")) { name = "ROOT"; } -File file = new File(configBase, name + ".xml"); - +File file = new File(configBase, name.replace('/', '_') + ".xml"); setConfigFile(file.getPath()); -if (log.isDebugEnabled()) -log.debug( "Set config file " + file); - } // Add missing components as necessary - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/06/22 10:14:25 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Oops, my earlier change on the order of JMX registration was incorrect. I noticed things were wrong because the mapper welcome file processing was broken after a webapp reload (quite annoying). - The JMX name is now constructed (the piepline init needs it, otherwise valves and stuff will never be unregistered, leaking objects), but the actual registration occurs after the context start is done. - Code cleanup. Revision ChangesPath 1.67 +23 -21 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- StandardContext.java 20 Jun 2003 21:18:45 - 1.66 +++ StandardContext.java 22 Jun 2003 17:14:24 - 1.67 @@ -4015,8 +4015,8 @@ // Initialize associated mapper mapper.setContext(getPath(), welcomeFiles, resources); -// JMX registration -registerJMX(); +// Set JMX object name for proper pipeline registration +preRegisterJMX(); // Start our child containers, if any Container children[] = findChildren(); @@ -4127,8 +4127,8 @@ setAvailable(false); } -// Wrappers JMX registration -registerWrappersJMX(); +// JMX registration +registerJMX(); // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); @@ -5031,33 +5031,35 @@ return oname; } -private void registerJMX() { +private void preRegisterJMX() { try { -StandardHost hst=(StandardHost)getParent(); -if( oname==null || oname.getKeyProperty("j2eeType")==null ) { - -oname=createObjectName(hst.getDomain(), hst.getJmxName()); -log.debug("Checking for " + oname ); -if(! Registry.getRegistry().getMBeanServer().isRegistered(oname)) -{ -controller=oname; -Registry.getRegistry().registerComponent(this,oname, null); -} +StandardHost host = (StandardHost) getParent(); +if ((oname == null) +|| (oname.getKeyProperty("j2eeType") == null)) { +oname = createObjectName(host.getDomain(), host.getJmxName()); +controller = oname; } -} catch( Exception ex ) { +} catch(Exception ex) { log.info("Error registering ctx with jmx " + this + " " + -oname + " " + ex.toString(), ex ); + oname + " " + ex.toString(), ex ); } } -private void registerWrappersJMX() { +private void registerJMX() { try { -for( Iterator it=wrappers.iterator(); it.hasNext() ; ) { +if (log.isDebugEnabled()) { +log.debug("Checking for " + oname ); +} +if(! Registry.getRegistry().getMBeanServer().isRegistered(oname)) { +controller = oname; +Registry.getRegistry().registerComponent(this, oname, null); +} +for (Iterator it = wrappers.iterator(); it.hasNext() ; ) { StandardWrapper wrapper=(StandardWrapper)it.next(); // XXX prevent duplicated registration wrapper.registerJMX( this ); } -} catch( Exception ex ) { +} catch (Exception ex) { log.info("Error registering wrapper with jmx " + this + " " + oname + " " + ex.toString(), ex ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
jfarcand2003/06/20 14:18:45 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix bugtraq 4880590 Container incorrectly processes invalid URL patterns in jsp-property-groups. This extends to non-jsp-property-group url-patterns as well as the catalina code that handles the jsp url pattern mappings delegates to the code that handles the servlet pattern mapping. Consider the following url-pattern: /somepath/*.jsp This is invalid but accepted and works within the server. The Servlet specification states that a valid URL pattern for an extension mapping like the example above must be '*.jsp' with no additional path information. Patch Submitted by: Ryan Lubke at sun.com Revision ChangesPath 1.66 +3 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- StandardContext.java 15 Jun 2003 13:10:40 - 1.65 +++ StandardContext.java 20 Jun 2003 21:18:45 - 1.66 @@ -1730,11 +1730,6 @@ servletName = "jsp"; } -// Properly handle file that are considered to be a jsp. -if (pattern.indexOf("*.") > 0){ -pattern = pattern.substring(pattern.lastIndexOf("*")); -servletName = "jsp"; -} if( findChild(servletName) != null) { addServletMapping(pattern, servletName); } else { @@ -4736,7 +4731,8 @@ else return (false); } -if (urlPattern.startsWith("/")) +if ( (urlPattern.startsWith("/")) && +(urlPattern.indexOf("*.") < 0)) return (true); else return (false); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/06/15 06:10:41 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Move context descriptors to $CATALINA_BASE/conf//, as proposed by Glenn. - This should make the feature secure, and I think there's no justification anymore for the deployXML flag. - Note: The manager webapp may need a few updates, which are in progress. Revision ChangesPath 1.65 +33 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- StandardContext.java 15 Jun 2003 07:09:10 - 1.64 +++ StandardContext.java 15 Jun 2003 13:10:40 - 1.65 @@ -3866,19 +3866,19 @@ boolean ok = true; // Set config file name -String appBase = getAppBase(); -if ((getConfigFile() == null) && (appBase != null)) { +File configBase = getConfigBase(); +if ((getConfigFile() == null) && (configBase != null)) { String name = getName(); if (name.equals("")) { name = "ROOT"; } -File file = new File(appBase); -file = new File(file, name + ".xml"); +File file = new File(configBase, name + ".xml"); setConfigFile(file.getPath()); -if( log.isDebugEnabled() ) +if (log.isDebugEnabled()) log.debug( "Set config file " + file); + } // Add missing components as necessary @@ -4542,6 +4542,33 @@ appBase = ((Host) container).getAppBase(); } return appBase; +} + + +/** + * Get config base. + */ +private File getConfigBase() { +File configBase = +new File(System.getProperty("catalina.base"), "conf"); +Container container = this; +Container host = null; +Container engine = null; +while (container != null) { +if (container instanceof Host) +host = container; +if (container instanceof Engine) +engine = container; +container = container.getParent(); +} +if (engine != null) { +configBase = new File(configBase, engine.getName()); +} +if (host != null) { +configBase = new File(configBase, host.getName()); +} +configBase.mkdirs(); +return configBase; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/06/15 00:09:10 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - The context needs to be registered in JMX before starting the pipeline. Otherwise, the valves will not get unregistered properly when undeploying. - I hope this does not cause other problems, but a fix was clearly needed. Revision ChangesPath 1.64 +29 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- StandardContext.java 29 May 2003 04:13:24 - 1.63 +++ StandardContext.java 15 Jun 2003 07:09:10 - 1.64 @@ -3867,7 +3867,7 @@ // Set config file name String appBase = getAppBase(); -if (getConfigFile() == null && appBase != null) { +if ((getConfigFile() == null) && (appBase != null)) { String name = getName(); if (name.equals("")) { @@ -4020,6 +4020,9 @@ // Initialize associated mapper mapper.setContext(getPath(), welcomeFiles, resources); +// JMX registration +registerJMX(); + // Start our child containers, if any Container children[] = findChildren(); for (int i = 0; i < children.length; i++) { @@ -4128,12 +4131,20 @@ } setAvailable(false); } -registerJMX(); + +// Wrappers JMX registration +registerWrappersJMX(); // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null); startTime=System.currentTimeMillis(); - + +// Close all JARs right away to avoid always opening a peak number +// of files on startup +if (getLoader() instanceof WebappLoader) { +((WebappLoader) getLoader()).closeJARs(true); +} + //cacheContext(); } @@ -4363,10 +4374,13 @@ ((StandardManager) getManager()).processExpires(); } -if (reloadable && (getLoader() != null)) { -if (getLoader().modified()) { +if (getLoader() != null) { +if (reloadable && (getLoader().modified())) { reload(); } +if (getLoader() instanceof WebappLoader) { +((WebappLoader) getLoader()).closeJARs(false); +} } } @@ -5007,13 +5021,21 @@ Registry.getRegistry().registerComponent(this,oname, null); } } +} catch( Exception ex ) { +log.info("Error registering ctx with jmx " + this + " " + +oname + " " + ex.toString(), ex ); +} +} + +private void registerWrappersJMX() { +try { for( Iterator it=wrappers.iterator(); it.hasNext() ; ) { StandardWrapper wrapper=(StandardWrapper)it.next(); // XXX prevent duplicated registration wrapper.registerJMX( this ); } } catch( Exception ex ) { -log.info("Error registering ctx with jmx " + this + " " + +log.info("Error registering wrapper with jmx " + this + " " + oname + " " + ex.toString(), ex ); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
jfarcand2003/05/28 21:13:24 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Revert back my latest changes since it did not fix the problem completely. Revision ChangesPath 1.63 +7 -25 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- StandardContext.java 28 May 2003 15:08:33 - 1.62 +++ StandardContext.java 29 May 2003 04:13:24 - 1.63 @@ -257,12 +257,7 @@ private boolean crossContext = false; -/** - * The default context name used for config file - */ -private String defaultConfigFile = "context.xml"; - -/** + /** * The display name of this web application. */ private String displayName = null; @@ -3878,25 +3873,12 @@ if (name.equals("")) { name = "ROOT"; } -File fileBase = new File(appBase); -File file = new File(fileBase, name + ".xml"); - -/* - * Try to save the context information using a default file name. - */ -if (!file.exists()){ -file = new File(fileBase, getDocBase() + File.separator + defaultConfigFile); -} +File file = new File(appBase); +file = new File(file, name + ".xml"); -// Make sure the file exist before setting it. -if (file.exists()){ -setConfigFile(file.getPath()); -if( log.isDebugEnabled() ) -log.debug( "Set config file " + file); -} else { -if( log.isDebugEnabled() ) -log.debug( "Config file doesn't exists: " + file); -} +setConfigFile(file.getPath()); +if( log.isDebugEnabled() ) +log.debug( "Set config file " + file); } // Add missing components as necessary - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
jfarcand2003/05/28 08:08:33 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Fix for bug 20217: restartContext doesn't work when a context configuration file maps a path to two levels. Revision ChangesPath 1.62 +25 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- StandardContext.java 26 May 2003 22:03:59 - 1.61 +++ StandardContext.java 28 May 2003 15:08:33 - 1.62 @@ -258,6 +258,11 @@ /** + * The default context name used for config file + */ +private String defaultConfigFile = "context.xml"; + +/** * The display name of this web application. */ private String displayName = null; @@ -3873,11 +3878,25 @@ if (name.equals("")) { name = "ROOT"; } -File file = new File(appBase); -file = new File(file, name + ".xml"); -if( log.isDebugEnabled() ) -log.debug( "Set config file " + file); -setConfigFile(file.getPath()); +File fileBase = new File(appBase); +File file = new File(fileBase, name + ".xml"); + +/* + * Try to save the context information using a default file name. + */ +if (!file.exists()){ +file = new File(fileBase, getDocBase() + File.separator + defaultConfigFile); +} + +// Make sure the file exist before setting it. +if (file.exists()){ +setConfigFile(file.getPath()); +if( log.isDebugEnabled() ) +log.debug( "Set config file " + file); +} else { +if( log.isDebugEnabled() ) +log.debug( "Config file doesn't exists: " + file); +} } // Add missing components as necessary - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
fhanik 2003/04/12 19:38:02 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: must look at the distributable element in web.xml before setting a replication manager Revision ChangesPath 1.37 +8 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- StandardContext.java 9 Apr 2003 19:25:39 - 1.36 +++ StandardContext.java 13 Apr 2003 02:38:02 - 1.37 @@ -871,14 +871,12 @@ } - /** * Set the distributable flag for this web application. * * @param distributable The new distributable flag */ public void setDistributable(boolean distributable) { - boolean oldDistributable = this.distributable; this.distributable = distributable; support.firePropertyChange("distributable", @@ -1798,7 +1796,6 @@ * registered */ public void addParameter(String name, String value) { - // Validate the proposed context initialization parameter if ((name == null) || (value == null)) throw new IllegalArgumentException @@ -3498,7 +3495,6 @@ if (log.isDebugEnabled()) log.debug("Starting filters"); - // Instantiate and record a FilterConfig for each defined filter boolean ok = true; synchronized (filterConfigs) { @@ -3890,7 +3886,13 @@ log.debug("Configuring default Manager"); if (getCluster() != null) { try { -setManager(getCluster().createManager(getName())); +if ( this.getDistributable() ) { +log.info("Creating clustering manager for context="+getName()); +setManager(getCluster().createManager(getName())); +} else { +log.info("Ignoring clustering manager for context="+getName()+ " element not present in web.xml"); +setManager(new StandardManager()); +} } catch ( Exception x ) { log.warn("Clustering disabled for context:"+getName()+" reason:"+x.getMessage()); setManager(new StandardManager()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
costin 2003/04/04 19:56:07 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Few more fixes - Amy, that should solve reloading problems ( at least it does for me ). I'm not sure if we do reset everything completely - that's what I'm experimenting with the new method. What needs to happen after stop() is similar with the recycle() in request - no trace of the old context and config should remain. unregister deals with the mapper. Doing few dozens restarts and looking at memory use will probably help Revision ChangesPath 1.33 +85 -54 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- StandardContext.java 25 Mar 2003 17:55:59 - 1.32 +++ StandardContext.java 5 Apr 2003 03:56:07 - 1.33 @@ -83,6 +83,8 @@ import javax.management.ObjectName; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; +import javax.management.InstanceNotFoundException; +import javax.management.MBeanRegistrationException; import org.apache.naming.ContextBindings; import org.apache.naming.resources.BaseDirContext; import org.apache.naming.resources.FileDirContext; @@ -4023,6 +4025,44 @@ } +/** + * Stop this Context component. Experimental, please ignore. + * + * @exception LifecycleException if a shutdown error occurs + */ +public synchronized void stopNew() throws LifecycleException { +// Mark this application as unavailable while we shut down +setAvailable(false); + +// Binding thread +ClassLoader oldCCL = bindThread(); + +try { +// Stop our filters +filterStop(); + +// Finalize our character set mapper +setCharsetMapper(null); + +// Stop our application listeners +listenerStop(); + +// Stop resources +resourcesStop(); + +super.stop(); +} finally { + +// Unbinding thread +unbindThread(oldCCL); + +} + +// Reset application context +context = null; + +wrappers = new ArrayList(); +} /** * Stop this Context component. @@ -4116,11 +4156,18 @@ context = null; wrappers = new ArrayList(); + +// This object will no longer be visible or used. +try { +resetContext(); +} catch( Exception ex ) { +log.error( "Error reseting context " + this + " " + ex, ex ); +} // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null); - + if (log.isDebugEnabled()) log.debug("Stopping complete"); } @@ -4139,42 +4186,17 @@ */ public void destroy() throws Exception { super.destroy(); - - +} + +private void resetContext() throws Exception, MBeanRegistrationException { // Restore the original state ( pre reading web.xml in start ) // If you extend this - override this method and make sure to clean up children=new HashMap(); - -StandardContext repl=new StandardContext(); -// All configurable options -repl.setAltDDName(altDDName); -repl.setCachingAllowed(cachingAllowed); -repl.setCharsetMapperClass(mapperClass); -repl.setConfigFile(configFile); -repl.setCookies(cookies); -repl.setCrossContext(crossContext); -repl.setDefaultWebXml(defaultWebXml); -//repl.setDistributable(distributable); // this is from web.xml -repl.setDocBase(docBase); -repl.setJ2EEApplication(j2EEApplication); -repl.setJ2EEServer(j2EEServer); -repl.setLazy(lazy); -repl.setMapperClass(mapperClass); -repl.setName(name); -repl.setOverride(override); -repl.setPath(getPath()); -repl.setPrivileged(privileged); -repl.setReloadable(reloadable); -repl.setReplaceWelcomeFiles(replaceWelcomeFiles); -repl.setSessionTimeout(sessionTimeout); -repl.setUseNaming(useNaming); -repl.setWrapperClass(wrapperClass); -repl.setWorkDir(workDir); -repl.setSwallowOutput(swallowOutp
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
costin 2003/03/25 09:56:01 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: First impl of reloading. Right now I put it in destroy() - so you need stop()/destroy()/init()/start(). Probably it can be in stop(). It needs some refactoring to deal with classes that extend StandardContext - probably "recreateContext()" method that can be overriden. Revision ChangesPath 1.32 +67 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- StandardContext.java 21 Mar 2003 07:34:39 - 1.31 +++ StandardContext.java 25 Mar 2003 17:55:59 - 1.32 @@ -497,6 +497,7 @@ */ private boolean cachingAllowed = true; +private boolean lazy=true; /** * Non proxied resources. @@ -876,6 +877,14 @@ } +// experimental +public boolean isLazy() { +return lazy; +} + +public void setLazy(boolean lazy) { +this.lazy = lazy; +} /** * Return descriptive information about this Container implementation and @@ -1969,7 +1978,7 @@ * will have been called, but no properties will have been set. */ public Wrapper createWrapper() { - +//log.info( "Create wrapper" ); Wrapper wrapper = new StandardWrapper(); wrappers.add(wrapper); @@ -3749,7 +3758,7 @@ * @exception LifecycleException if a startup error occurs */ public synchronized void start() throws LifecycleException { - +//if (lazy ) return; if (started) { log.info(sm.getString("containerBase.alreadyStarted", logName())); return; @@ -4106,14 +4115,68 @@ // Reset application context context = null; +wrappers = new ArrayList(); + // Notify our interested LifecycleListeners lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null); + if (log.isDebugEnabled()) log.debug("Stopping complete"); - } +/** Destroy needs to clean up the context completely. + * + * The problem is that undoing all the config in start() and restoring + * a 'fresh' state is impossible. After stop()/destroy()/init()/start() + * we should have the same state as if a fresh start was done - i.e + * read modified web.xml, etc. This can only be done by completely + * removing the context object and remapping a new one, or by cleaning + * up everything. + * + * XXX Should this be done in stop() ? + * + */ +public void destroy() throws Exception { +super.destroy(); + + +// Restore the original state ( pre reading web.xml in start ) +// If you extend this - override this method and make sure to clean up +children=new HashMap(); + +StandardContext repl=new StandardContext(); +// All configurable options +repl.setAltDDName(altDDName); +repl.setCachingAllowed(cachingAllowed); +repl.setCharsetMapperClass(mapperClass); +repl.setConfigFile(configFile); +repl.setCookies(cookies); +repl.setCrossContext(crossContext); +repl.setDefaultWebXml(defaultWebXml); +//repl.setDistributable(distributable); // this is from web.xml +repl.setDocBase(docBase); +repl.setJ2EEApplication(j2EEApplication); +repl.setJ2EEServer(j2EEServer); +repl.setLazy(lazy); +repl.setMapperClass(mapperClass); +repl.setName(name); +repl.setOverride(override); +repl.setPath(getPath()); +repl.setPrivileged(privileged); +repl.setReloadable(reloadable); +repl.setReplaceWelcomeFiles(replaceWelcomeFiles); +repl.setSessionTimeout(sessionTimeout); +repl.setUseNaming(useNaming); +repl.setWrapperClass(wrapperClass); +repl.setWorkDir(workDir); +repl.setSwallowOutput(swallowOutput); + +if( oname != null ) +mserver.unregisterMBean(oname); +Registry.getRegistry().registerComponent(repl, oname, null); + +} /** * Return a String representation of this component. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java StandardEngine.java StandardHost.java
costin 2003/03/20 23:34:40 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java StandardEngine.java StandardHost.java Log: Various fixes. Both embed and standalone are working again. Revision ChangesPath 1.31 +5 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- StandardContext.java 21 Mar 2003 06:38:47 - 1.30 +++ StandardContext.java 21 Mar 2003 07:34:39 - 1.31 @@ -3761,7 +3761,7 @@ throw new LifecycleException("Error initializaing ", ex); } } - + String logName="tomcat." + getParent().getName() + "." + ("".equals(getName()) ? "ROOT" : getName()) + ".Context"; log=org.apache.commons.logging.LogFactory.getLog(logName); @@ -4783,6 +4783,9 @@ } ContextConfig config = new ContextConfig(); this.addLifecycleListener(config); + +mserver.invoke(parentName, "addChild", new Object[] { this }, +new String[] {"org.apache.catalina.Container"}); } super.init(); } 1.8 +31 -19 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java Index: StandardEngine.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- StandardEngine.java 19 Mar 2003 07:23:57 - 1.7 +++ StandardEngine.java 21 Mar 2003 07:34:39 - 1.8 @@ -71,6 +71,7 @@ import javax.servlet.http.HttpServletResponse; import javax.management.ObjectName; import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.DefaultContext; @@ -391,7 +392,25 @@ } if( service==null ) { -// for consistency... +try { +ObjectName serviceName=getParentName(); +if( mserver.isRegistered( serviceName )) { +log.info("Registering with the service "); +try { +mserver.invoke( serviceName, "setContainer", +new Object[] { this }, +new String[] { "org.apache.catalina.Container" } ); +} catch( Exception ex ) { +ex.printStackTrace(); +} +} +} catch( Exception ex ) { +log.error("Error registering with service "); +} +} + +if( service==null ) { +// for consistency...: we are probably in embeded mode try { service=new StandardService(); service.initialize(); @@ -466,24 +485,17 @@ { super.preRegister(server,name); -// Register with the Service. XXX Do we really need a Service ?? -// BTW - the connector can go directly here. -ObjectName serviceName=new ObjectName(domain + -":type=Service,name=Tomcat-Standalone"); -if( server.isRegistered( serviceName )) { -log.info("Registering with the service "); -try { -server.invoke( serviceName, "setContainer", -new Object[] { this }, -new String[] { "org.apache.catalina.Container" } ); -} catch( Exception ex ) { -ex.printStackTrace(); -} -} +this.setName( name.getDomain()); return name; } +public ObjectName getParentName() throws MalformedObjectNameException { +ObjectName serviceName=new ObjectName(domain + +":type=Service"); +return serviceName; +} + public ObjectName createObjectName(String domain, ObjectName parent) throws Exception { 1.8 +11 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java Index: StandardHost.java === RCS file: /home/cvs/jakarta-tomcat-catal
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
costin 2003/03/16 23:26:42 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: Remove "service=", cleaner way to deal with the "j2eeApplication" and server - now they're also exposed as attributes, so a real j2ee server can set them when creating the context ( via JMX ) Revision ChangesPath 1.28 +32 -6 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- StandardContext.java 14 Mar 2003 23:49:22 - 1.27 +++ StandardContext.java 17 Mar 2003 07:26:40 - 1.28 @@ -508,6 +508,9 @@ private long startupTime; private long tldScanTime; +private String j2EEApplication="none"; +private String j2EEServer="none"; + // - Context Properties public void setName( String name ) { @@ -885,6 +888,22 @@ } +public String getJ2EEApplication() { +return j2EEApplication; +} + +public void setJ2EEApplication(String j2EEApplication) { +this.j2EEApplication = j2EEApplication; +} + +public String getJ2EEServer() { +return j2EEServer; +} + +public void setJ2EEServer(String j2EEServer) { +this.j2EEServer = j2EEServer; +} + /** * Set the Loader with which this Context is associated. @@ -1647,7 +1666,11 @@ pattern = pattern.substring(pattern.lastIndexOf("*")); servletName = "jsp"; } -addServletMapping(pattern, servletName); +if( findChild(servletName) != null) { +addServletMapping(pattern, servletName); +} else { +log.info("Skiping " + pattern + " , no servlet " + servletName); +} } @@ -4672,14 +4695,17 @@ String onameStr=null; try { if( oname==null || oname.getKeyProperty("j2eeType")==null ) { -ContainerBase ctx=(ContainerBase)parent; +StandardHost ctx=(StandardHost)parent; String pathName=getName(); String hostName=getParent().getName(); String name= "//" + ((hostName==null)? "DEFAULT" : hostName) + (("".equals(pathName))?"/":pathName ); -onameStr="j2eeType=WebModule,name=" + name + -ctx.getJSR77Suffix(); +String suffix=",J2EEApplication=" + +getJ2EEApplication() + ",J2EEServer=" + +getJ2EEServer(); + +onameStr="j2eeType=WebModule,name=" + name + suffix; if( log.isDebugEnabled()) log.debug("Registering " + onameStr + " for " + oname); @@ -4763,7 +4789,7 @@ } // XXX The service and domain should be the same. ObjectName parentName=new ObjectName( domain + ":" + -"type=Host,host=" + hostName + ",service=Tomcat-Standalone"); +"type=Host,host=" + hostName); log.info("Adding to " + parentName ); if( ! mserver.isRegistered(parentName)) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
fhanik 2003/03/14 15:49:23 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: small change to allow the cluster to throw an exception when it decides not to cluster enable a context, and at that point, we simply fallback on the StandardManager Revision ChangesPath 1.27 +20 -15 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- StandardContext.java 12 Mar 2003 21:32:49 - 1.26 +++ StandardContext.java 14 Mar 2003 23:49:22 - 1.27 @@ -158,10 +158,10 @@ /** * The alternate deployment descriptor name. - */ + */ private String altDDName = null; - + /** * The set of application listener class names configured for this * application, in the order they were encountered in the web.xml file. @@ -791,15 +791,15 @@ } - + /** * Return the alternate Deployment Descriptor name. */ public String getAltDDName(){ return altDDName; } - - + + /** * Set an alternate Deployment Descriptor name. */ @@ -1145,7 +1145,7 @@ if (context == null) { context = new ApplicationContext(getBasePath(), this); -if (altDDName != null) +if (altDDName != null) context.setAttribute(Globals.ALT_DD_ATTR,altDDName); } return (context.getFacade()); @@ -1261,7 +1261,7 @@ // The proxied resources will be refreshed on start this.resources = null; -support.firePropertyChange("resources", oldResources, +support.firePropertyChange("resources", oldResources, this.webappResources); } @@ -1634,19 +1634,19 @@ * property group, we only care about the URL pattern here. The * JSP container will parse the rest. * - * @param pattern URL pattern to be mapped + * @param pattern URL pattern to be mapped */ public void addJspMapping(String pattern) { String servletName = findServletMapping("*.jsp"); if (servletName == null) { servletName = "jsp"; } - + // Properly handle file that are considered to be a jsp. if (pattern.indexOf("*.") > 0){ pattern = pattern.substring(pattern.lastIndexOf("*")); servletName = "jsp"; -} +} addServletMapping(pattern, servletName); } @@ -3625,7 +3625,7 @@ env.put(ProxyDirContext.CONTEXT, getName()); try { -ProxyDirContext proxyDirContext = +ProxyDirContext proxyDirContext = new ProxyDirContext(env, webappResources); if (webappResources instanceof BaseDirContext) { ((BaseDirContext) webappResources).setDocBase(getBasePath()); @@ -3751,7 +3751,7 @@ // Set config file name String appBase = getAppBase(); if (getConfigFile() == null && appBase != null) { - + String name = getName(); if (name.equals("")) { name = "ROOT"; @@ -3798,7 +3798,12 @@ if (log.isDebugEnabled()) log.debug("Configuring default Manager"); if (getCluster() != null) { -setManager(getCluster().createManager(getName())); +try { +setManager(getCluster().createManager(getName())); +} catch ( Exception x ) { +log.warn("Clustering disabled for context:"+getName()+" reason:"+x.getMessage()); +setManager(new StandardManager()); +} } else { setManager(new StandardManager()); } @@ -4464,7 +4469,7 @@ Class.forName("org.apache.catalina.valves.RequestListenerValve"); requestListener = (Valve) clazz.newInstance(); } catch (Throwable t) { -return false; +return false; } // Add this Valve to our Pipeline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
[EMAIL PROTECTED] wrote: > remm2003/03/12 13:32:50 > > Modified:catalina/src/share/org/apache/catalina/core > StandardContext.java > Log: > - If init needs guards against being invoked twice, this also needs it. > - Any explanation why, BTW ? The general idea is simple: components shouldn't assume a perfect world where everything is consistent and loaded in a certain order. In this particular case - I assume the mbean for the context couldn't find the parent to register itself - when it adds itself to the host, the host will call setParent(). On destroy - I don't think this is a problem. Costin > > Revision ChangesPath > 1.26 +4 -2 > jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java > > Index: StandardContext.java > === > RCS file: > /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v > retrieving revision 1.25 retrieving revision 1.26 > diff -u -r1.25 -r1.26 > --- StandardContext.java12 Mar 2003 06:24:15 - 1.25 > +++ StandardContext.java12 Mar 2003 21:32:49 - 1.26 > @@ -4780,7 +4780,9 @@ >if( started ) { >stop(); >} > -parent.removeChild(this); > +if (parent != null) { > +parent.removeChild(this); > +} >} > >public void create() throws Exception{ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/03/12 13:32:50 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - If init needs guards against being invoked twice, this also needs it. - Any explanation why, BTW ? Revision ChangesPath 1.26 +4 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- StandardContext.java 12 Mar 2003 06:24:15 - 1.25 +++ StandardContext.java 12 Mar 2003 21:32:49 - 1.26 @@ -4780,7 +4780,9 @@ if( started ) { stop(); } -parent.removeChild(this); +if (parent != null) { +parent.removeChild(this); +} } public void create() throws Exception{ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
costin 2003/03/11 22:24:15 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - forgive duplicated start() - remove unused imports ( thanks Idea ) - Add support for a "defaultWebXml" configuration option. It adds a bit more flexibility ( you could configure different defaults for different sets of webapps ) and reduces the dependency on catalina.base env. - stop using catalina.base if engine.baseDir is set - we should do a grep and make sure catalina.base system property is never used ( otherwise it's almost impossible to support the original goal of multiple engines in a vm ) - few fixes in jmx registration. Create a host automatically if none set ( using the hostname from the jsr77 name of the context ) - implement destroy for jmx deregistration - moved methods from mbeans - so all the JMX model is in StandardContext, we can remove the extra wrapper Revision ChangesPath 1.25 +89 -36 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- StandardContext.java 11 Mar 2003 19:39:06 - 1.24 +++ StandardContext.java 12 Mar 2003 06:24:15 - 1.25 @@ -1,7 +1,4 @@ /* - * $Header$ - * $Revision$ - * $Date$ * * * @@ -92,23 +89,7 @@ import org.apache.naming.resources.ProxyDirContext; import org.apache.naming.resources.WARDirContext; import org.apache.naming.resources.DirContextURLStreamHandler; -import org.apache.catalina.Container; -import org.apache.catalina.ContainerListener; -import org.apache.catalina.Context; -import org.apache.catalina.Host; -import org.apache.catalina.Globals; -import org.apache.catalina.InstanceListener; -import org.apache.catalina.Lifecycle; -import org.apache.catalina.LifecycleEvent; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.LifecycleListener; -import org.apache.catalina.Loader; -import org.apache.catalina.Mapper; -import org.apache.catalina.Pipeline; -import org.apache.catalina.Request; -import org.apache.catalina.Response; -import org.apache.catalina.Valve; -import org.apache.catalina.Wrapper; +import org.apache.catalina.*; import org.apache.catalina.startup.ContextConfig; import org.apache.catalina.startup.TldConfig; import org.apache.catalina.mbeans.MBeanUtils; @@ -263,6 +244,10 @@ */ private String displayName = null; +/** Override the default web xml location. ContextConfig is not configurable + * so the setter is not used. + */ +private String defaultWebXml; /** * The distributable flag for this web application. @@ -765,6 +750,22 @@ } +public String getDefaultWebXml() { +return defaultWebXml; +} + +/** Set the location of the default web xml that will be used. + * If not absolute, it'll be made relative to the engine's base dir + * ( which defaults to catalina.base system property ). + * + * XXX If a file is not found - we can attempt a getResource() + * + * @param defaultWebXml + */ +public void setDefaultWebXml(String defaultWebXml) { +this.defaultWebXml = defaultWebXml; +} + public long getStartupTime() { return startupTime; } @@ -3726,9 +3727,10 @@ */ public synchronized void start() throws LifecycleException { -if (started) -throw new LifecycleException -(sm.getString("containerBase.alreadyStarted", logName())); +if (started) { +log.info(sm.getString("containerBase.alreadyStarted", logName())); +return; +} String logName="tomcat." + getParent().getName() + "." + ("".equals(getName()) ? "ROOT" : getName()) + ".Context"; @@ -4156,9 +4158,12 @@ * entire servlet container (i.e. the Engine container if present). */ protected File engineBase() { - -return (new File(System.getProperty("catalina.base"))); - +String base=System.getProperty("catalina.base"); +if( base == null ) { +StandardEngine eng=(StandardEngine)this.getParent().getParent(); +base=eng.getBaseDir(); +} +return (new File(base)); } @@ -4373,7 +4378,7 @@ // Create this directory if necessary File dir = new File(workDir); if (!dir.isAbsolute()) { -Fil
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/03/05 11:09:27 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix incorrect logging. - Submitted by Jonathan Baker Revision ChangesPath 1.23 +5 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- StandardContext.java 5 Mar 2003 18:20:04 - 1.22 +++ StandardContext.java 5 Mar 2003 19:09:26 - 1.23 @@ -3649,7 +3649,7 @@ } } } catch (Throwable t) { -log.error(sm.getString("standardContext.resourcesStop", t)); +log.error(sm.getString("standardContext.resourcesStop"), t); ok = false; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
remm2003/03/05 10:20:04 Modified:catalina/src/share/org/apache/catalina/core StandardContext.java Log: - Fix incorrect logging. - Submitted by Jonathan Baker Revision ChangesPath 1.22 +5 -5 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- StandardContext.java 5 Mar 2003 05:01:06 - 1.21 +++ StandardContext.java 5 Mar 2003 18:20:04 - 1.22 @@ -3623,7 +3623,7 @@ } this.resources = proxyDirContext; } catch (Throwable t) { -log.error(sm.getString("standardContext.resourcesStart", t)); +log.error(sm.getString("standardContext.resourcesStart"), t); ok = false; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]