cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gkossakow...@apache.org
Subject svn commit: r620534 - in /cocoon/whiteboard/micro/core/cocoon-core: pom.xml src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java
Date Mon, 11 Feb 2008 17:31:28 GMT
Author: gkossakowski
Date: Mon Feb 11 09:31:24 2008
New Revision: 620534

URL: http://svn.apache.org/viewvc?rev=620534&view=rev
Log:
At least for now we can't rely on Spring when it comes to dependency on ServletContext. It
must be taken directly from CallStack but this introduces dependency on SSF implementation
so should be considered as temporary solution.

Modified:
    cocoon/whiteboard/micro/core/cocoon-core/pom.xml
    cocoon/whiteboard/micro/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java

Modified: cocoon/whiteboard/micro/core/cocoon-core/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-core/pom.xml?rev=620534&r1=620533&r2=620534&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-core/pom.xml (original)
+++ cocoon/whiteboard/micro/core/cocoon-core/pom.xml Mon Feb 11 09:31:24 2008
@@ -101,6 +101,10 @@
       <artifactId>cocoon-configuration-api</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-servlet-service-impl</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.cocoon.micro</groupId>
       <artifactId>cocoon-micro-pipeline-components</artifactId>
     </dependency>

Modified: cocoon/whiteboard/micro/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java?rev=620534&r1=620533&r2=620534&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java
(original)
+++ cocoon/whiteboard/micro/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/CocoonSourceResolver.java
Mon Feb 11 09:31:24 2008
@@ -22,8 +22,6 @@
 import java.net.URL;
 import java.util.Map;
 
-import javax.servlet.ServletContext;
-
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
@@ -33,9 +31,10 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.Processor;
+import org.apache.cocoon.callstack.CallStack;
 import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.apache.cocoon.servletservice.CallStackHelper;
 import org.apache.cocoon.util.AbstractLogEnabled;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceException;
@@ -62,8 +61,6 @@
 
     /** The base URL */
     protected URL baseURL;
-    
-    protected ServletContext servletContext;
 
     /**
      * @see Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
@@ -97,8 +94,10 @@
      */
     public Source resolveURI(String location, String baseURI, Map parameters)
     throws IOException {
-        if (baseURI == null) {
-            baseURI = servletContext.getResource("/").toExternalForm();
+        //FIXME: This tieds CocoonSourceResolver to the SSF impl but it's temporary solution
+        //here we are switching baseURI to to the URI of the servlet we are in
+        if (baseURI == null && CallStack.getCurrentFrame() != null) {
+            baseURI = CallStackHelper.getCurrentServletContext().getResource("/").toExternalForm();
         }
         if (this.customResolver != null) {
             return this.customResolver.resolveURI(location, baseURI, parameters);
@@ -195,8 +194,6 @@
             this.customResolver = (org.apache.excalibur.source.SourceResolver)
                     this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE +
"/Cocoon");
         }
-        //We obtain ServletContext which is properly scoped so we can always be sure that
we reference the right one
-        servletContext = (ServletContext)manager.lookup("javax.servlet.ServletContext/callstack");
     }
 
     /**



Mime
View raw message