cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r158584 - cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java
Date Tue, 22 Mar 2005 09:27:30 GMT
Author: cziegeler
Date: Tue Mar 22 01:27:29 2005
New Revision: 158584

URL: http://svn.apache.org/viewcvs?view=rev&rev=158584
Log:
Set application context as request attribute

Modified:
    cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java

Modified: cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java?view=diff&r1=158583&r2=158584
==============================================================================
--- cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java
(original)
+++ cocoon/blocks/spring-app/trunk/java/org/apache/cocoon/spring/SpringComponentLocator.java
Tue Mar 22 01:27:29 2005
@@ -32,9 +32,15 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.core.Core;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.cocoon.servlet.CocoonServlet;
 import org.apache.cocoon.sitemap.ComponentLocator;
+import org.apache.cocoon.sitemap.EnterSitemapEvent;
+import org.apache.cocoon.sitemap.EnterSitemapEventListener;
+import org.apache.cocoon.sitemap.LeaveSitemapEvent;
+import org.apache.cocoon.sitemap.LeaveSitemapEventListener;
 import org.apache.excalibur.source.SourceResolver;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeansException;
@@ -65,7 +71,9 @@
                Serviceable,
                Configurable,
                Initializable,
-               Disposable {
+               Disposable,
+               EnterSitemapEventListener,
+               LeaveSitemapEventListener {
 
     protected Context context;
     protected ServletContext servletContext;
@@ -291,4 +299,20 @@
         return parentContext;
     }
 
+    /**
+     * @see org.apache.cocoon.sitemap.EnterSitemapEventListener#enteredSitemap(org.apache.cocoon.sitemap.EnterSitemapEvent)
+     */
+    public void enteredSitemap(EnterSitemapEvent event) {
+        final Request request = ObjectModelHelper.getRequest(event.getEnvironment().getObjectModel());
+        request.setAttribute("application-context", this.wac);
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.LeaveSitemapEventListener#leftSitemap(org.apache.cocoon.sitemap.LeaveSitemapEvent)
+     */
+    public void leftSitemap(LeaveSitemapEvent event) {
+        // TODO We have to restore the old value!
+        final Request request = ObjectModelHelper.getRequest(event.getEnvironment().getObjectModel());
+        request.removeAttribute("application-context");
+    }
 }



Mime
View raw message