tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkemn...@apache.org
Subject [2/2] git commit: TAP5-2311: URL-decode the loadPage parameter to fix reloading of nested pages
Date Fri, 02 May 2014 08:01:12 GMT
TAP5-2311: URL-decode the loadPage parameter to fix reloading of nested pages


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7294f9bc
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7294f9bc
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7294f9bc

Branch: refs/heads/master
Commit: 7294f9bcbf15a677cf8ec27a9db2c647d4115d4c
Parents: a7b4556
Author: Jochen Kemnade <jochen.kemnade@eddyson.de>
Authored: Fri May 2 09:46:37 2014 +0200
Committer: Jochen Kemnade <jochen.kemnade@eddyson.de>
Committed: Fri May 2 10:00:35 2014 +0200

----------------------------------------------------------------------
 .../corelib/pages/ExceptionReport.java          |  5 ++++-
 .../integration/app1/CoreBehaviorsTests.java    | 15 +++++++++++++
 .../tapestry5/integration/app1/pages/Index.java |  4 +++-
 .../pages/nested/PageThatThrowsException.java   | 23 ++++++++++++++++++++
 4 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
index 3676c20..e6db1ed 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
@@ -99,6 +99,9 @@ public class ExceptionReport implements ExceptionReporter
 
     @Inject
     private ReloadHelper reloadHelper;
+    
+    @Inject
+    private URLEncoder urlEncoder;
 
     @Property
     private String rootURL;
@@ -129,7 +132,7 @@ public class ExceptionReport implements ExceptionReporter
     {
         reloadHelper.forceReload();
 
-        return linkSource.createPageRenderLinkWithContext(request.getParameter("loadPage"),
reloadContext);
+        return linkSource.createPageRenderLinkWithContext(urlEncoder.decode(request.getParameter("loadPage")),
reloadContext);
     }
 
     Object onActionFromReloadRoot() throws MalformedURLException

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
index 1655716..2179b98 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
@@ -1705,4 +1705,19 @@ public class CoreBehaviorsTests extends App1TestCase
         assertTextPresent("Page called with correct activation context",
                 "You should never see me if use an erroneous activation context");
     }
+    
+    /**
+     * TAP5-2311
+     */
+    @Test
+    public void reload_from_nested_page()
+    {
+        openLinks("Reload on nested page");
+
+        assertTextPresent("This page throws an exception");
+        
+        clickAndWait("css=a:contains('Go to page'):contains('with reload')");
+        
+        assertTextPresent("This page throws an exception");
+    }
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index fcd8647..bfd68f3 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -559,7 +559,9 @@ public class Index
 
                     new Item("ModuleConfigurationCallbackDemo", "ModuleConfigurationCallback
Demo", "Shows an example of changing the Require.js configuration using JavaScriptSupport.addModuleConfigurationDemo()"),
 
-                    new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo",
"Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer")
+                    new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo",
"Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer"),
+
+                    new Item("nested/PageThatThrowsException", "Reload on nested page", "Tests
a page reload from a nested page's exception report")
 
             );
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7294f9bc/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
new file mode 100644
index 0000000..7af9849
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/PageThatThrowsException.java
@@ -0,0 +1,23 @@
+// Copyright 2006, 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.
+
+package org.apache.tapestry5.integration.app1.pages.nested;
+
+public class PageThatThrowsException
+{
+    void beginRender(){
+      throw new RuntimeException("This page throws an exception");
+      
+    }
+}


Mime
View raw message