cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r516992 - /cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java
Date Sun, 11 Mar 2007 19:14:26 GMT
Author: reinhard
Date: Sun Mar 11 12:14:25 2007
New Revision: 516992

URL: http://svn.apache.org/viewvc?view=rev&rev=516992
Log:
don't fail if the wrapper is used in other projects than the demo
(will remove the test code as soon as the Spring reloading bug got fixed)

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

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java?view=diff&rev=516992&r1=516991&r2=516992
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java
Sun Mar 11 12:14:25 2007
@@ -31,6 +31,8 @@
 import org.springframework.core.io.DefaultResourceLoader;
 import org.springframework.web.context.ContextLoader;
 import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.support.ServletContextFactoryBean;
 import org.springframework.web.context.support.WebApplicationContextUtils;
 import org.springframework.web.context.support.XmlWebApplicationContext;
 
@@ -61,26 +63,43 @@
                     throw new ServletException("Cannot load class " + ContextLoader.class.getName(),
e);
                 }
                 
-                ApplicationContext oldAc = WebApplicationContextUtils.getRequiredWebApplicationContext(this.config.getServletContext());
-                this.log.debug("Old application context: " + oldAc);
-                Object o = oldAc.getBean("global-bean");
-                this.log.debug("o[old]: " + o.toString());                
+                // debugging code
+                try {
+                    ApplicationContext oldAc = WebApplicationContextUtils.getRequiredWebApplicationContext(this.config.getServletContext());
+                    this.log.debug("Old application context: " + oldAc);
+                    Object o = oldAc.getBean("global-bean");
+                    this.log.debug("o[old]: " + o.toString());             
+                } catch(Exception e) {
+                }
+                // debugging code end
                 
                 // close old Spring application context
                 springContextLoader.closeWebApplicationContext(this.config.getServletContext());
                 this.config.getServletContext().removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
 
                 // create the new Spring application context
+                ServletContextFactoryBean b = new ServletContextFactoryBean();
+                b.setServletContext(this.config.getServletContext());
                 XmlWebApplicationContext xac = (XmlWebApplicationContext) springContextLoader.initWebApplicationContext(this.config.getServletContext());
-                DefaultResourceLoader drl = (DefaultResourceLoader) xac;
-                drl.setClassLoader(cl);
-                xac.refresh();
-                Object o1 = xac.getBean("global-bean");
-                this.log.debug("o[new]: " + o1.toString());
+                
+                // debugging code
+                try {
+                    DefaultResourceLoader drl = (DefaultResourceLoader) xac;
+                    drl.setClassLoader(cl);
+                    xac.refresh();
+                    Object o1 = xac.getBean("global-bean");
+                    this.log.debug("o[new]: " + o1.toString());
+                } catch(Exception e) {
+                }
+                // debugging code end
                 
                 if(log.isDebugEnabled()) {
                     log.debug("Reloaded Spring application context: " + xac);
                 }                
+                
+                
+                RequestContextHolder.resetRequestAttributes();
+                
             }
         }
         // continue processing the request



Mime
View raw message