You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/06/13 11:48:21 UTC
[09/11] git commit: refactor done an comment changed
refactor done an comment changed
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/58daafa5
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/58daafa5
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/58daafa5
Branch: refs/heads/master
Commit: 58daafa556ccf334bd7d03c83eab9973d83fb497
Parents: 4950a77
Author: Michael Mosmann <mi...@mosmann.de>
Authored: Thu Sep 27 01:08:45 2012 +0200
Committer: Michael Mosmann <mi...@mosmann.de>
Committed: Thu Sep 27 01:08:45 2012 +0200
----------------------------------------------------------------------
.../request/handler/render/WebPageRenderer.java | 56 ++++++++++----------
1 file changed, 27 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/58daafa5/wicket-core/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java b/wicket-core/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java
index 6bb7b90..5854ed4 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/handler/render/WebPageRenderer.java
@@ -201,6 +201,13 @@ public class WebPageRenderer extends PageRenderer
if (shouldRedirectToTargetUrl(isAjax, redirectPolicy, isRedirectToRender, targetEqualsCurrentUrl, isNewPageInstance, isPageStateless, sessionTemporary))
{
redirectTo(targetUrl, requestCycle);
+
+ // note: if we had session here we would render the page to buffer and then redirect to
+ // URL generated *after* page has been rendered (the statelessness may change during
+ // render). this would save one redirect because now we have to render to URL generated
+ // *before* page is rendered, render the page, get URL after render and if the URL is
+ // different (meaning page is not stateless), save the buffer and redirect again (which
+ // is pretty much what the next step does)
}
else
{
@@ -265,47 +272,38 @@ public class WebPageRenderer extends PageRenderer
}
}
- protected static boolean shouldRedirectToTargetUrl(boolean ajax, RedirectPolicy redirectPolicy, boolean redirectToRender, boolean targetEqualsCurrentUrl, boolean newPageInstance, boolean pageStateless,boolean sessionTemporary) {
- return shouldRedirectToTargetUrlConditionA(ajax, redirectPolicy, redirectToRender, targetEqualsCurrentUrl)
- ||
- shouldAlsoRedirectToTargetUrlConditionB(targetEqualsCurrentUrl, newPageInstance, pageStateless,sessionTemporary);
- }
-
// if
// render policy is always-redirect
- // or
+ // or
// it's redirect-to-render
// or
// its ajax and the targetUrl matches current url
+ // or
+ // targetUrl DONT matches current url and
+ // is new page instance
+ // or
+ // session is temporary and page is stateless
// just redirect
- private static boolean shouldRedirectToTargetUrlConditionA(boolean ajax, RedirectPolicy redirectPolicy, boolean redirectToRender, boolean targetEqualsCurrentUrl) {
+
+ protected static boolean shouldRedirectToTargetUrl(boolean ajax, RedirectPolicy redirectPolicy, boolean redirectToRender, boolean targetEqualsCurrentUrl, boolean newPageInstance, boolean pageStateless,boolean sessionTemporary) {
return alwaysRedirect(redirectPolicy) //
||
redirectToRender //
||
- (ajax && targetEqualsCurrentUrl);
- }
-
- // if target URL is different and session is temporary and page is stateless
- // this is special case when page is stateless but there is no session so we can't
- // render it to buffer
-
- // alternatively if URLs are different and we have a page class and not an instance we
- // can redirect to the url which will instantiate the instance of us
-
- // note: if we had session here we would render the page to buffer and then redirect to
- // URL generated *after* page has been rendered (the statelessness may change during
- // render). this would save one redirect because now we have to render to URL generated
- // *before* page is rendered, render the page, get URL after render and if the URL is
- // different (meaning page is not stateless), save the buffer and redirect again (which
- // is pretty much what the next step does)
- private static boolean shouldAlsoRedirectToTargetUrlConditionB(boolean targetEqualsCurrentUrl, boolean newPageInstance, boolean pageStateless, boolean sessionTemporary) {
- return !targetEqualsCurrentUrl //
- &&
- (newPageInstance || (sessionTemporary && pageStateless));
+ (ajax && targetEqualsCurrentUrl)
+ ||
+ (!targetEqualsCurrentUrl //
+ &&
+ (newPageInstance || (sessionTemporary && pageStateless))
+ );
+ // if target URL is different and session is temporary and page is stateless
+ // this is special case when page is stateless but there is no session so we can't
+ // render it to buffer
+
+ // alternatively if URLs are different and we have a page class and not an instance we
+ // can redirect to the url which will instantiate the instance of us
}
-
// if
// the policy is never to redirect
// or