cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r510461 - /cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/
Date Thu, 22 Feb 2007 11:16:34 GMT
Author: reinhard
Date: Thu Feb 22 03:16:29 2007
New Revision: 510461

URL: http://svn.apache.org/viewvc?view=rev&rev=510461
Log:
- remove System.out

Modified:
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/CocoonReloadingListener.java
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingClassloaderManager.java
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingListener.java
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingServlet.java
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingSpringFilter.java

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/CocoonReloadingListener.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/CocoonReloadingListener.java?view=diff&rev=510461&r1=510460&r2=510461
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/CocoonReloadingListener.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/CocoonReloadingListener.java
Thu Feb 22 03:16:29 2007
@@ -33,10 +33,12 @@
     }
 
     public void onChangeFile(File changedFile) {
-        System.out.println("A file changed: "
-                + changedFile.getAbsolutePath());
+        System.out.println("A file changed: " + changedFile.getAbsolutePath());
         super.onChangeFile(changedFile);
         notifySubscribers();
+        
+        // TODO be more specific when to reload. Not every change needs a reload of the Spring
+        // application context
         reload = true;
     }
 

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingClassloaderManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingClassloaderManager.java?view=diff&rev=510461&r1=510460&r2=510461
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingClassloaderManager.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingClassloaderManager.java
Thu Feb 22 03:16:29 2007
@@ -17,11 +17,9 @@
 package org.apache.cocoon.servlet;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 
@@ -57,22 +55,7 @@
                 classloader.addListener(rl);
                 fam.addListener(rl);
             }
-            fam.start();    
-            
-            
-            // (rpoetz) debugging stuff: get a list of all resources with the name 
-            // "META-INF/cocoon/spring/demo-application-context.xml"
-            ReloadingClassloaderManager.reloadingClassloader = classloader;            
-            Enumeration o = null;
-            try {
-                o = classloader.getResources("META-INF/cocoon/spring/demo-application-context.xml");
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-            if(o != null) while(o.hasMoreElements()) {
-                System.out.println("--> rcl: " + o.nextElement());
-            }
-            // (rpoetz) end debugging stuff
+            fam.start();
         }   
         return ReloadingClassloaderManager.reloadingClassloader;
     }    

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingListener.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingListener.java?view=diff&rev=510461&r1=510460&r2=510461
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingListener.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingListener.java
Thu Feb 22 03:16:29 2007
@@ -104,9 +104,6 @@
                         ClassLoader cl = ReloadingClassloaderManager.getClassLoader(this.context);
                         Class listenerClass = cl.loadClass(className);
                         final Object listener = listenerClass.newInstance();
-                        ClassLoader listenerClassloader = listener.getClass().getClassLoader();
-                        System.out.println("ReloadingListener: ReloadingClassloaderManager.getClassLoader().getClass()="
+ className + "; cl=" + ReloadingClassloaderManager.getClassLoader(this.context).getClass().getName());
-                        System.out.println("ReloadingListener: listener.getClass().getClassloader()="
+ listenerClassloader);
                         if ( listener instanceof HttpSessionListener ) {
                             this.httpSessionListeners.add(listener);
                         }

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingServlet.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingServlet.java?view=diff&rev=510461&r1=510460&r2=510461
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingServlet.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingServlet.java
Thu Feb 22 03:16:29 2007
@@ -58,12 +58,8 @@
         // Create the servlet
         try {
             ClassLoader cl = ReloadingClassloaderManager.getClassLoader(config.getServletContext());
-//            System.out.println("ReloadingServlet: rcm.getClassloader=" + cl);
             Class servletClass = cl.loadClass(servletName);
-//            System.out.println("ReloadingServlet: servletClass.getClassloader()=" + servletClass.getClassLoader());
             this.servlet = (Servlet) servletClass.newInstance();
-//            System.out.println("ReloadingServlet compare=" + (cl == servletClass.getClassLoader()));
-
         } catch (Exception e) {
             throw new ServletException("Cannot load servlet " + servletName, e);
         }

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingSpringFilter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingSpringFilter.java?view=diff&rev=510461&r1=510460&r2=510461
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingSpringFilter.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/servlet/ReloadingSpringFilter.java
Thu Feb 22 03:16:29 2007
@@ -21,18 +21,16 @@
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
-import javax.servlet.Servlet;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
-import org.springframework.context.ApplicationContext;
 import org.springframework.web.context.ContextLoader;
 import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
 
-/*
- * For now only some experimental stuff regarding the reload of the Spring application context.
+/**
+ * This servlet filter reloads the Spring application context whenever a relevant change
in the
+ * classpath occurs. 
  * 
  * @version $Id$
  */
@@ -48,7 +46,6 @@
                 // load the spring context loader from the reloading classloader
                 ClassLoader cl = ReloadingClassloaderManager.getClassLoader(config.getServletContext());
                 String contextLoaderClassName = ContextLoader.class.getName();
-                System.out.println("ReloadingSpringFilter#doFilter: contextLoaderClassName="
+ contextLoaderClassName);
                 ContextLoader springContextLoader = null;
                 try {
                     Class contextLoaderClass = cl.loadClass(contextLoaderClassName);
@@ -56,37 +53,13 @@
                 } catch (Exception e) {
                     throw new ServletException("Cannot load class " + contextLoaderClassName,
e);
                 }
-                System.out.println("ReloadingSpringFilter#doFilter: classloader=" + springContextLoader.getClass().getClassLoader());
               
                 
                 // close old Spring application context
-                ApplicationContext appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(this.config.getServletContext());
-                System.out.println("ReloadingSpringFilter#doFilter: old appContext: " + appContext);
               
                 springContextLoader.closeWebApplicationContext(this.config.getServletContext());
-                System.out.println("ReloadingSpringFilter#doFilter: after close");      
                
                 this.config.getServletContext().removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
-                System.out.println("ReloadingSpringFilter#doFilter: after removeAttribute");
                 
                 // create the new Spring application context
                 springContextLoader.initWebApplicationContext(this.config.getServletContext());
-                System.out.println("ReloadingSpringFilter#doFilter: after initWebApplicationContext");
-                appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(this.config.getServletContext());
-                System.out.println("ReloadingSpringFilter#doFilter: after getRequiredWebApplicationContext");
               
-                System.out.println("ReloadingSpringFilter#doFilter: newContext=" + appContext);
               
-                
-                
-                /*
-                ApplicationContext appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(this.config.getServletContext());
-                System.out.println("ReloadingSpringFilter#doFilter: old appContext: " + appContext);
-                
-                ContextLoader springContextLoader = new ContextLoader();
-                System.out.println("ReloadingSpringFilter#doFilter: classloader=: " + springContextLoader.getClass().getClassLoader());
-                springContextLoader.closeWebApplicationContext(this.config.getServletContext());
-                this.config.getServletContext().removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
-                springContextLoader.initWebApplicationContext(this.config.getServletContext());
-                
-                appContext = WebApplicationContextUtils.getWebApplicationContext(this.config.getServletContext());
-                System.out.println("ReloadingSpringFilter#doFilter: " + appContext);
-                */     
             }
         }
         // continue processing the request



Mime
View raw message