You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by da...@apache.org on 2005/07/04 00:16:39 UTC

svn commit: r208989 - in /cocoon/trunk/src/java/org/apache/cocoon: environment/http/HttpContext.java servlet/CocoonServlet.java

Author: danielf
Date: Sun Jul  3 15:16:36 2005
New Revision: 208989

URL: http://svn.apache.org/viewcvs?rev=208989&view=rev
Log:
Using /WEB-INF/web.xml for finding out the root servlet path instead of just /WEB-INF as the bundle protocol in OSGi has problems with accessing directories. Hopefully it doesn't affect existing code.

Modified:
    cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpContext.java
    cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpContext.java?rev=208989&r1=208988&r2=208989&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpContext.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/environment/http/HttpContext.java Sun Jul  3 15:16:36 2005
@@ -76,11 +76,11 @@
             if (value == null) {
                 // Try to figure out the path of the root from that of WEB-INF
                 try {
-                value = this.servletContext.getResource("/WEB-INF").toString();
+                value = this.servletContext.getResource("/WEB-INF/web.xml").toString();
                 } catch (MalformedURLException mue) {
                     throw new CascadingRuntimeException("Cannot determine the base URL for " + path, mue);
                 }
-                value = value.substring(0,value.length()-"WEB-INF".length());
+                value = value.substring(0,value.length()-"WEB-INF/web.xml".length());
             }
             return value;
         }

Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=208989&r1=208988&r2=208989&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java Sun Jul  3 15:16:36 2005
@@ -161,14 +161,14 @@
         // as the logger isn't initialized yet.
         String debugPathOne = null, debugPathTwo = null;
         if (path == null) {
-            // Try to figure out the path of the root from that of WEB-INF
+            // Try to figure out the path of the root from that of WEB-INF/web.xml
             try {
-                path = this.servletContext.getResource("/WEB-INF").toString();
+                path = this.servletContext.getResource("/WEB-INF/web.xml").toString();
             } catch (MalformedURLException me) {
-                throw new ServletException("Unable to get resource 'WEB-INF'.", me);
+                throw new ServletException("Unable to get resource 'WEB-INF/web.xml'.", me);
             }
             debugPathOne = path;
-            path = path.substring(0, path.length() - "WEB-INF".length());
+            path = path.substring(0, path.length() - "WEB-INF/web.xml".length());
             debugPathTwo = path;
         }
         try {