You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/01/03 03:56:06 UTC

svn commit: r608316 - in /tapestry/tapestry5/trunk: src/site/ src/site/apt/ tapestry-core/src/main/java/org/apache/tapestry/internal/services/ tapestry-core/src/test/java/org/apache/tapestry/internal/services/

Author: hlship
Date: Wed Jan  2 18:56:05 2008
New Revision: 608316

URL: http://svn.apache.org/viewvc?rev=608316&view=rev
Log:
TAPESTRY-1713: Tapestry doesn't run correctly on Websphere 6.1 due to an incorrect implementation of HttpServletRequest.getServletPath()

Added:
    tapestry/tapestry5/trunk/src/site/apt/websphere.apt
Modified:
    tapestry/tapestry5/trunk/src/site/site.xml
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestImplTest.java

Added: tapestry/tapestry5/trunk/src/site/apt/websphere.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/websphere.apt?rev=608316&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/websphere.apt (added)
+++ tapestry/tapestry5/trunk/src/site/apt/websphere.apt Wed Jan  2 18:56:05 2008
@@ -0,0 +1,24 @@
+ ----
+ Deployment Notes: WebSphere
+ ----
+
+Deployment Notes: WebSphere
+
+  WebSphere <<6.1>> can work with Tapestry ... if configured correctly.  WebSphere doesn't quite
+  conform to the Servlet API specification.
+
+  This can be addressed by installing fixpack 9:
+
+  * {{{http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg1PK31377}http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg1PK31377}}
+
+  * {{{http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg1PK33090}http://www-1.ibm.com/support/docview.wss?rs=180&uid=swg1PK33090}}
+
+  []
+
+  In addition, you must configure the setting <<<com.ibm.ws.webcontainer.invokeFiltersCompatibility>>> to <<<true>>>.  With
+  all of that in place (plus some additional code inside Tapestry that patches around WebSphere's odd behavior), you
+  should be ready to deploy with WebSphere.
+
+* Logging
+
+  TODO: Discuss logging configuration for WebSphere.
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/site.xml?rev=608316&r1=608315&r2=608316&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/trunk/src/site/site.xml Wed Jan  2 18:56:05 2008
@@ -1,81 +1,83 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!-- 
-   Copyright 2007 The Apache Software Foundation
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-
+<!-- 
+   Copyright 2007 The Apache Software Foundation
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
 <project name="Apache Tapestry">
-  <bannerLeft>
-    <name>Tapestry 5</name>
-    <href>http://tapestry.apache.org/tapestry5/</href>
-    <src>images/tapestry_banner.gif</src>
-  </bannerLeft>
-  <bannerRight>
-    <name>Apache</name>
-    <href>http://www.apache.org</href>
-    <src>images/asf_logo_wide.gif</src>
-  </bannerRight>
-  <skin>
-    <groupId>org.apache.tapestry</groupId>
-    <artifactId>maven-skin</artifactId>
-    <version>1.1</version>
-  </skin>
-
-  <publishDate format="dd MMM yyyy"/>
-
-  <body>
-
-    <menu name="Tapestry 5 Project">
-      <item name="Screencasts" href="screencast.html"/>
-      <item name="Tapestry for Struts Developers" href="struts.html"/>
-      <item name="Download" href="http://tapestry.apache.org/download.html"/>
-       <item name="Release Notes" href="release-notes.html"/>
-       <item name="Nightly Docs" href="http://tapestry.formos.com/nightly/tapestry5/"/>
-    </menu>
-
-    <menu name="Tapestry 5 Modules">
-      <item name="tapestry-annotations" href="tapestry-annotations/"/>
-      <item name="tapestry-core" href="tapestry-core/"/>
-      <item name="tapestry-hibernate" href="tapestry-hibernate/"/>
-      <item name="tapestry-ioc" href="tapestry-ioc/"/>
-      <item name="tapestry-spring" href="tapestry-spring/"/>
-      <item name="tapestry-test" href="tapestry-test/"/>
-      <item name="tapestry-upload" href="tapestry-upload/"/>
-    </menu>
-    
-    <menu name="Tapestry Tutorials">
-      <item name="Tutorial #1" href="tutorial1/"/>
-    </menu>
-
-    <menu name="Tapestry 5 Maven Support">
-      <item name="quickstart" href="quickstart/"/>
-      <item name="tapestry-component-report" href="tapestry-component-report/"/>
-    </menu>
-    
-
-    <menu name="Deployment Notes">
-      <item name="Jetty" href="jetty.html"/>
-      <item name="Tomcat" href="tomcat.html"/>
-      <item name="JBoss" href="jboss.html"/>
-    </menu>
-
-    <menu name="Developer Info">
-      <item name="Environment" href="dev/env.html"/>
-      <item name="Release Checklist" href="dev/checklist.html"/>
-    </menu>
-
-    <menu ref="reports"/>
-
-  </body>
+    <bannerLeft>
+        <name>Tapestry 5</name>
+        <href>http://tapestry.apache.org/tapestry5/</href>
+        <src>images/tapestry_banner.gif</src>
+    </bannerLeft>
+    <bannerRight>
+        <name>Apache</name>
+        <href>http://www.apache.org</href>
+        <src>images/asf_logo_wide.gif</src>
+    </bannerRight>
+    <skin>
+        <groupId>org.apache.tapestry</groupId>
+        <artifactId>maven-skin</artifactId>
+        <version>1.1</version>
+    </skin>
+
+    <publishDate format="dd MMM yyyy"/>
+
+    <body>
+
+        <menu name="Tapestry 5 Project">
+            <item name="Screencasts" href="screencast.html"/>
+            <item name="Tapestry for Struts Developers" href="struts.html"/>
+            <item name="Download" href="http://tapestry.apache.org/download.html"/>
+            <item name="Release Notes" href="release-notes.html"/>
+            <item name="Nightly Docs" href="http://tapestry.formos.com/nightly/tapestry5/"/>
+            <item name="Issues" href="https://issues.apache.org/jira/browse/TAPESTRY"/>
+        </menu>
+
+        <menu name="Tapestry 5 Modules">
+            <item name="tapestry-annotations" href="tapestry-annotations/"/>
+            <item name="tapestry-core" href="tapestry-core/"/>
+            <item name="tapestry-hibernate" href="tapestry-hibernate/"/>
+            <item name="tapestry-ioc" href="tapestry-ioc/"/>
+            <item name="tapestry-spring" href="tapestry-spring/"/>
+            <item name="tapestry-test" href="tapestry-test/"/>
+            <item name="tapestry-upload" href="tapestry-upload/"/>
+        </menu>
+
+        <menu name="Tapestry Tutorials">
+            <item name="Tutorial #1" href="tutorial1/"/>
+        </menu>
+
+        <menu name="Tapestry 5 Maven Support">
+            <item name="quickstart" href="quickstart/"/>
+            <item name="tapestry-component-report" href="tapestry-component-report/"/>
+        </menu>
+
+
+        <menu name="Deployment Notes">
+            <item name="Jetty" href="jetty.html"/>
+            <item name="Tomcat" href="tomcat.html"/>
+            <item name="JBoss" href="jboss.html"/>
+            <item name="WebSphere" href="websphere.html"/>
+        </menu>
+
+        <menu name="Developer Info">
+            <item name="Environment" href="dev/env.html"/>
+            <item name="Release Checklist" href="dev/checklist.html"/>
+        </menu>
+
+        <menu ref="reports"/>
+
+    </body>
 </project>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestImpl.java?rev=608316&r1=608315&r2=608316&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestImpl.java Wed Jan  2 18:56:05 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -68,7 +68,14 @@
 
     public String getPath()
     {
-        return _request.getServletPath();
+        String pathInfo = _request.getPathInfo();
+
+        if (pathInfo == null) return _request.getServletPath();
+
+        // Websphere 6.1 is a bit wonky (see TAPESTRY-1713), and tends to return the empty string
+        // for the servlet path, and return the true path in pathInfo.
+
+        return pathInfo.length() == 0 ? "/" : pathInfo;
     }
 
     public String getContextPath()

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestImplTest.java?rev=608316&r1=608315&r2=608316&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestImplTest.java Wed Jan  2 18:56:05 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -124,5 +124,68 @@
     public Object[][] xhr_inputs()
     {
         return new Object[][]{{null, false}, {"", false}, {"some other value", false}, {"XMLHttpRequest", true}};
+    }
+
+    @Test
+    public void get_path_for_normal_servlet_container()
+    {
+        String path = "/foo/bar";
+
+        HttpServletRequest sr = mockHttpServletRequest();
+
+        train_getPathInfo(sr, null);
+        expect(sr.getServletPath()).andReturn(path);
+
+        replay();
+
+        Request request = new RequestImpl(sr);
+
+        assertEquals(request.getPath(), path);
+
+        verify();
+    }
+
+    /**
+     * TAPESTRY-1713
+     */
+    @Test
+    public void get_path_for_websphere_with_empty_path()
+    {
+        String path = "/foo/bar";
+
+        HttpServletRequest sr = mockHttpServletRequest();
+
+        train_getPathInfo(sr, path);
+
+        replay();
+
+        Request request = new RequestImpl(sr);
+
+        assertEquals(request.getPath(), path);
+
+        verify();
+    }
+
+    /**
+     * TAPESTRY-1713
+     */
+    public void get_path_for_websphere_with_nonempty_path()
+    {
+        HttpServletRequest sr = mockHttpServletRequest();
+
+        train_getPathInfo(sr, "");
+
+        replay();
+
+        Request request = new RequestImpl(sr);
+
+        assertEquals(request.getPath(), "/");
+
+        verify();
+    }
+
+    protected final void train_getPathInfo(HttpServletRequest request, String pathInfo)
+    {
+        expect(request.getPathInfo()).andReturn(pathInfo).atLeastOnce();
     }
 }