cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: rev 46947 - in cocoon/branches/BRANCH_2_1_X: lib src/blocks/faces/conf src/blocks/faces/java/org/apache/cocoon/faces/context src/blocks/faces/lib src/blocks/faces/samples
Date Mon, 20 Sep 2004 20:13:54 GMT
Author: vgritsenko
Date: Mon Sep 20 13:13:51 2004
New Revision: 46947

Added:
   cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-20040920m.jar
      - copied, changed from rev 46945, cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-20040916m.jar
   cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-jsf-api-20040920m.jar
      - copied, changed from rev 46945, cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-jsf-api-20040916.jar
Removed:
   cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-20040916m.jar
   cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-jsf-api-20040916.jar
Modified:
   cocoon/branches/BRANCH_2_1_X/lib/jars.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/faces/conf/faces-listener.xweb
   cocoon/branches/BRANCH_2_1_X/src/blocks/faces/java/org/apache/cocoon/faces/context/ExternalContextImpl.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/faces/samples/samples.xml
Log:
Emulate prefix servlet mapping for faces context.
Works out of the box with Sun's JSF 1.1_01 RI, requires less patching
for myfaces, works with buggy websphere.


Modified: cocoon/branches/BRANCH_2_1_X/lib/jars.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/lib/jars.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/lib/jars.xml	Mon Sep 20 13:13:51 2004
@@ -1140,7 +1140,7 @@
       specification.
     </description>
     <used-by>Faces block</used-by>
-    <lib>faces/lib/myfaces-20040916m.jar</lib>
+    <lib>faces/lib/myfaces-20040920m.jar</lib>
     <homepage>http://www.myfaces.org/</homepage>
   </file>
 
@@ -1151,7 +1151,7 @@
       specification.
     </description>
     <used-by>Faces block</used-by>
-    <lib>faces/lib/myfaces-jsf-api-20040916.jar</lib>
+    <lib>faces/lib/myfaces-jsf-api-20040920m.jar</lib>
     <homepage>http://www.myfaces.org/</homepage>
   </file>
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/faces/conf/faces-listener.xweb
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/faces/conf/faces-listener.xweb	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/faces/conf/faces-listener.xweb	Mon Sep 20 13:13:51
2004
@@ -19,6 +19,10 @@
 <xweb xpath="/web-app" unless="listener" insert-before="node()[1]">
 
   <listener>
+    <!--
+      - JavaServer Faces configuration loader. For Sun's RI implementation use
+      - com.sun.faces.config.ConfigureListener class.
+      -->
     <listener-class>net.sourceforge.myfaces.webapp.StartupServletContextListener</listener-class>
   </listener>
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/faces/java/org/apache/cocoon/faces/context/ExternalContextImpl.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/faces/java/org/apache/cocoon/faces/context/ExternalContextImpl.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/faces/java/org/apache/cocoon/faces/context/ExternalContextImpl.java
Mon Sep 20 13:13:51 2004
@@ -66,7 +66,7 @@
     public String encodeActionURL(String url) {
         FacesRedirector redirector = (FacesRedirector)request.getAttribute(FacesAction.REQUEST_REDIRECTOR_ATTRIBUTE);
         if (redirector == null) {
-            throw new RuntimeException("Can not dispatch to <" + url + ">: Redirector
missing.");
+            throw new RuntimeException("Can not encode action URL <" + url + ">: Redirector
missing.");
         }
 
         return redirector.encodeActionURL(url);
@@ -79,7 +79,7 @@
     public String encodeResourceURL(String url) {
         FacesRedirector redirector = (FacesRedirector)request.getAttribute(FacesAction.REQUEST_REDIRECTOR_ATTRIBUTE);
         if (redirector == null) {
-            throw new RuntimeException("Can not dispatch to <" + url + ">: Redirector
missing.");
+            throw new RuntimeException("Can not encode resource URL <" + url + ">:
Redirector missing.");
         }
 
         return redirector.encodeResourceURL(url);
@@ -156,11 +156,45 @@
     }
 
     public String getRequestPathInfo() {
-        return this.request.getPathInfo();
+        // HACK (VG):
+        // Emulate servlet prefix mapping. This allows to bypass suffix mapping calculations,
+        // as well as helps with WebSphere servlet container bugs (it treats default servlet
+        // as prefix mapped servlet).
+
+        // JSF Specification, 2.2.1 Restore View:
+        //   o Derive the view identifier that corresponds to this request, as follows:
+        //     o If prefix mapping (such as ?/faces/*?) is used for FacesServlet, the viewId
+        //       is set from the extra path information of the request URI.
+
+        StringBuffer path = new StringBuffer();
+
+        boolean slash = false;
+        String s = request.getServletPath();
+        if (s != null) {
+            path.append(s);
+            slash = s.endsWith("/");
+        }
+
+        s = request.getPathInfo();
+        if (s != null) {
+            if (s.startsWith("/")) {
+                if (slash){
+                    s = s.substring(1);
+                }
+            } else {
+                if (!slash) {
+                    path.append('/');
+                }
+            }
+            path.append(s);
+        }
+
+        return path.toString();
     }
 
     public String getRequestServletPath() {
-        return this.request.getServletPath();
+        // See #getRequestPathInfo
+        return "";
     }
 
     public URL getResource(String resource) throws MalformedURLException {
@@ -210,7 +244,7 @@
     public void redirect(String url) throws IOException {
         FacesRedirector redirector = (FacesRedirector)request.getAttribute(FacesAction.REQUEST_REDIRECTOR_ATTRIBUTE);
         if (redirector == null) {
-            throw new IOException("Can not dispatch to " + url + ": Redirector missing.");
+            throw new IOException("Can not redirect to <" + url + ">: Redirector missing.");
         }
 
         redirector.redirect(url);

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-20040920m.jar (from rev
46945, cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-20040916m.jar)
==============================================================================
Binary files. No diff available.

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-jsf-api-20040920m.jar (from
rev 46945, cocoon/branches/BRANCH_2_1_X/src/blocks/faces/lib/myfaces-jsf-api-20040916.jar)
==============================================================================
Binary files. No diff available.

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/faces/samples/samples.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/faces/samples/samples.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/faces/samples/samples.xml	Mon Sep 20 13:13:51
2004
@@ -31,9 +31,8 @@
     </note>
     <note>
       Faces block comes with MyFaces JSF implementation with this small patch
-      applied. Cocoon Faces block can also be run with Sun (JSF 1.1) and
-      IBM implementations (WSAD 5.1.2) if those implementations are patched
-      appropriately.
+      applied. Cocoon Faces block can also be run with Sun (JSF 1.1_01) and
+      IBM implementations (WSAD 5.1.2, requires patching).
     </note>
     <sample name="Patch" href="myfaces-patch.diff">
       Patch against MyFaces CVS repository as of 20040916.

Mime
View raw message