WICKET-5424 record rendered page after wrapped render has responded

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/52766371
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/52766371
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/52766371

Branch: refs/heads/wicket-6.x
Commit: 5276637135f108d1036c2098ca438a650180f226
Parents: 8094436
Author: svenmeier <s...@meiers.net>
Authored: Tue Nov 26 12:47:10 2013 +0100
Committer: svenmeier <s...@meiers.net>
Committed: Tue Nov 26 12:47:10 2013 +0100

----------------------------------------------------------------------
 .../wicket/util/tester/BaseWicketTester.java    | 37 +++++++++++++++-----
 1 file changed, 28 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/52766371/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java 
b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
index 16efa26..7b8806a 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
@@ -40,6 +40,7 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpSession;
 
 import junit.framework.AssertionFailedError;
+
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.IPageManagerProvider;
@@ -2646,17 +2647,35 @@ public class BaseWicketTester
                }
 
                @Override
-               public PageRenderer get(RenderPageRequestHandler handler)
+               public PageRenderer get(final RenderPageRequestHandler handler)
                {
-                       Page newPage = 
(Page)handler.getPageProvider().getPageInstance();
-                       if (componentInPage != null && lastPage != null &&
-                               lastPage.getPageClass() != 
newPage.getPageClass())
+                       return new PageRenderer(handler)
                        {
-                               // WICKET-3913: reset startComponent if a new 
page type is rendered
-                               componentInPage = null;
-                       }
-                       lastRenderedPage = lastPage = newPage;
-                       return delegate.get(handler);
+                               @Override
+                               public void respond(RequestCycle requestCycle)
+                               {
+                                       
delegate.get(handler).respond(requestCycle);
+
+                                       // WICKET-5424 record page after 
wrapped renderer has
+                                       // responded
+                                       if 
(handler.getPageProvider().hasPageInstance())
+                                       {
+                                               Page renderedPage = 
(Page)handler.getPageProvider().getPageInstance();
+                                               if (componentInPage != null && 
lastPage != null
+                                                               && 
lastPage.getPageClass() != renderedPage.getPageClass())
+                                               {
+                                                       // WICKET-3913: reset 
startComponent if a new page
+                                                       // type is rendered
+                                                       componentInPage = null;
+                                               }
+                                               lastRenderedPage = lastPage = 
renderedPage;
+                                       }
+                                       else
+                                       {
+                                               lastRenderedPage = null;
+                                       }
+                               }
+                       };
                }
        }
 

Reply via email to