You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by th...@apache.org on 2012/09/25 13:49:44 UTC

svn commit: r1389820 - in /cocoon/subprojects/cocoon-servlet-service-impl/trunk: pom.xml src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java

Author: thorsten
Date: Tue Sep 25 11:49:44 2012
New Revision: 1389820

URL: http://svn.apache.org/viewvc?rev=1389820&view=rev
Log:
COCOON3-105

Applying cleaned up patch from Francesco Chicchiriccò

Modified:
    cocoon/subprojects/cocoon-servlet-service-impl/trunk/pom.xml
    cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java

Modified: cocoon/subprojects/cocoon-servlet-service-impl/trunk/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-servlet-service-impl/trunk/pom.xml?rev=1389820&r1=1389819&r2=1389820&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-servlet-service-impl/trunk/pom.xml (original)
+++ cocoon/subprojects/cocoon-servlet-service-impl/trunk/pom.xml Tue Sep 25 11:49:44 2012
@@ -103,6 +103,11 @@
       <artifactId>cocoon-jnet</artifactId>
       <version>1.2.2</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-block-deployment</artifactId>
+      <version>1.2.2-SNAPSHOT</version>
+    </dependency>
     <!-- commons -->
     <dependency>
       <groupId>commons-collections</groupId>

Modified: cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java?rev=1389820&r1=1389819&r2=1389820&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java (original)
+++ cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java Tue Sep 25 11:49:44 2012
@@ -42,7 +42,10 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.cocoon.blockdeployment.BlockContextURLStreamHandler;
+import org.apache.cocoon.blockdeployment.BlockDeploymentServletContextListener;
 import org.apache.cocoon.servletservice.util.ServletContextWrapper;
+import org.apache.cocoon.spring.configurator.WebAppContextUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -99,7 +102,7 @@ public class ServletServiceContext exten
             this.attributes = map;
         }
     }
-    
+
     @Override
     public URL getResource(String path) throws MalformedURLException {
         if (path == null || !path.startsWith("/")) {
@@ -111,11 +114,17 @@ public class ServletServiceContext exten
         // lazy initialization of the base URL
         synchronized (this) {
             if (this.contextPathURL == null) {
-                this.contextPathURL = new URL(this.contextPath);
+                final Map<String, String> blockContexts = (Map<String, String>) WebAppContextUtils
+                        .getCurrentWebApplicationContext()
+                        .getServletContext()
+                        .getAttribute(
+                                BlockDeploymentServletContextListener.BLOCK_CONTEXT_MAP);
+                this.contextPathURL = new URL(null, this.contextPath,
+                        new BlockContextURLStreamHandler(blockContexts));
             }
+            return new URL(this.contextPathURL, path.substring(1));
         }
 
-        return new URL(this.contextPathURL, path.substring(1));
     }
 
     public String getRealPath(String path) {