Updated Branches:
  refs/heads/master 5cdd8624c -> 813c022d7

WICKET-5410 Remove setting interfaces

Remove IRequestCycleSettings interface


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

Branch: refs/heads/master
Commit: 813c022d75df4a6f551e76fb526376fc3809bc6f
Parents: 5cdd862
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Tue Nov 12 12:08:45 2013 +0200
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Tue Nov 12 12:08:45 2013 +0200

----------------------------------------------------------------------
 .../java/org/apache/wicket/Application.java     |   7 +-
 .../markup/html/pages/BrowserInfoPage.java      |   4 +-
 .../request/handler/render/PageRenderer.java    |  11 +-
 .../wicket/settings/IRequestCycleSettings.java  | 305 -------------------
 .../settings/def/RequestCycleSettings.java      | 258 ++++++++++++++--
 .../wicket/util/tester/BaseWicketTester.java    |   3 +-
 .../http/WebResponseExceptionsTest.java         |   4 +-
 .../handler/render/WebPageRendererTest.java     |  21 +-
 .../examples/library/LibraryApplication.java    |   4 +-
 9 files changed, 254 insertions(+), 363 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-core/src/main/java/org/apache/wicket/Application.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java 
b/wicket-core/src/main/java/org/apache/wicket/Application.java
index 946c420..0359459 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Application.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Application.java
@@ -85,7 +85,6 @@ import org.apache.wicket.session.DefaultPageFactory;
 import org.apache.wicket.session.ISessionStore;
 import org.apache.wicket.session.ISessionStore.UnboundListener;
 import org.apache.wicket.settings.IMarkupSettings;
-import org.apache.wicket.settings.IRequestCycleSettings;
 import org.apache.wicket.settings.IRequestLoggerSettings;
 import org.apache.wicket.settings.IResourceSettings;
 import org.apache.wicket.settings.ISecuritySettings;
@@ -1037,7 +1036,7 @@ public abstract class Application implements 
UnboundListener, IEventSink
        private PageSettings pageSettings;
 
        /** The Request Cycle Settings */
-       private IRequestCycleSettings requestCycleSettings;
+       private RequestCycleSettings requestCycleSettings;
 
        /** The Request Logger Settings */
        private IRequestLoggerSettings requestLoggerSettings;
@@ -1192,7 +1191,7 @@ public abstract class Application implements 
UnboundListener, IEventSink
        /**
         * @return Application's request cycle related settings
         */
-       public final IRequestCycleSettings getRequestCycleSettings()
+       public final RequestCycleSettings getRequestCycleSettings()
        {
                checkSettingsAvailable();
                if (requestCycleSettings == null)
@@ -1206,7 +1205,7 @@ public abstract class Application implements 
UnboundListener, IEventSink
         * 
         * @param requestCycleSettings
         */
-       public final void setRequestCycleSettings(final IRequestCycleSettings 
requestCycleSettings)
+       public final void setRequestCycleSettings(final RequestCycleSettings 
requestCycleSettings)
        {
                this.requestCycleSettings = requestCycleSettings;
        }

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
index 3f5452b..5692a28 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/pages/BrowserInfoPage.java
@@ -27,7 +27,6 @@ import org.apache.wicket.protocol.http.ClientProperties;
 import org.apache.wicket.protocol.http.WebSession;
 import org.apache.wicket.protocol.http.request.WebClientInfo;
 import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.settings.IRequestCycleSettings;
 
 
 /**
@@ -39,7 +38,8 @@ import org.apache.wicket.settings.IRequestCycleSettings;
  * </p>
  * <p>
  * This page is being used by the default implementation of {@link 
org.apache.wicket.Session#getClientInfo()},
- * which in turn uses {@link 
IRequestCycleSettings#getGatherExtendedBrowserInfo() a setting} to
+ * which in turn uses
+ * {@link 
org.apache.wicket.settings.def.RequestCycleSettings#getGatherExtendedBrowserInfo()
 a setting} to
  * determine whether this page should be redirected to (it does when it is 
true).
  * </p>
  * 

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-core/src/main/java/org/apache/wicket/request/handler/render/PageRenderer.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/request/handler/render/PageRenderer.java
 
b/wicket-core/src/main/java/org/apache/wicket/request/handler/render/PageRenderer.java
index cf67324..c47371a 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/request/handler/render/PageRenderer.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/request/handler/render/PageRenderer.java
@@ -23,7 +23,7 @@ import 
org.apache.wicket.core.request.handler.RenderPageRequestHandler;
 import 
org.apache.wicket.core.request.handler.RenderPageRequestHandler.RedirectPolicy;
 import org.apache.wicket.request.component.IRequestablePage;
 import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.settings.IRequestCycleSettings.RenderStrategy;
+import org.apache.wicket.settings.def.RequestCycleSettings;
 
 /**
  * Delegate responsible for rendering the page. Depending on the 
implementation (web, test, portlet,
@@ -80,17 +80,20 @@ public abstract class PageRenderer
 
        protected boolean isOnePassRender()
        {
-               return 
Application.get().getRequestCycleSettings().getRenderStrategy() == 
RenderStrategy.ONE_PASS_RENDER;
+               return 
Application.get().getRequestCycleSettings().getRenderStrategy() ==
+                               
RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER;
        }
 
        protected boolean isRedirectToRender()
        {
-               return 
Application.get().getRequestCycleSettings().getRenderStrategy() == 
RenderStrategy.REDIRECT_TO_RENDER;
+               return 
Application.get().getRequestCycleSettings().getRenderStrategy() ==
+                               
RequestCycleSettings.RenderStrategy.REDIRECT_TO_RENDER;
        }
 
        protected boolean isRedirectToBuffer()
        {
-               return 
Application.get().getRequestCycleSettings().getRenderStrategy() == 
RenderStrategy.REDIRECT_TO_BUFFER;
+               return 
Application.get().getRequestCycleSettings().getRenderStrategy() ==
+                               
RequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER;
        }
 
        /**

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-core/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java
 
b/wicket-core/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java
deleted file mode 100644
index dd29ba0..0000000
--- 
a/wicket-core/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.wicket.settings;
-
-import java.util.List;
-
-import org.apache.wicket.Session;
-import org.apache.wicket.markup.html.pages.BrowserInfoPage;
-import org.apache.wicket.response.filter.IResponseFilter;
-import org.apache.wicket.util.time.Duration;
-
-
-/**
- * Interface for request related settings
- * <p>
- * <i>bufferResponse </i> (defaults to true) - True if the application should 
buffer responses. This
- * does require some additional memory, but helps keep exception displays 
accurate because the whole
- * rendering process completes before the page is sent to the user, thus 
avoiding the possibility of
- * a partially rendered page.
- * <p>
- * <i>renderStrategy </i>- Sets in what way the render part of a request is 
handled. Basically,
- * there are two different options:
- * <ul>
- * <li>Direct, IRequestCycleSettings.RenderStrategy.ONE_PASS_RENDER. 
Everything is handled in one
- * physical request. This is efficient, and is the best option if you want to 
do sophisticated
- * clustering. It does not however, shield you from what is commonly known as 
the <i>Double submit
- * problem </i></li>
- * <li>Using a redirect. This follows the pattern <a
- * 
href="http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost"; 
>as described at the
- * serverside </a> and that is commonly known as Redirect after post. Wicket 
takes it one step
- * further to do any rendering after a redirect, so that not only form submits 
are shielded from the
- * double submit problem, but also the IRequestListener handlers (that could 
be e.g. a link that
- * deletes a row). With this pattern, you have two options to choose from:
- * <ul>
- * <li>IRequestCycleSettings.RenderStrategy.REDIRECT_TO_RENDER. This option 
first handles the
- * 'action' part of the request, which is either page construction 
(bookmarkable pages or the home
- * page) or calling a IRequestListener handler, such as Link.onClick. When 
that part is done, a
- * redirect is issued to the render part, which does all the rendering of the 
page and its
- * components. <strong>Be aware </strong> that this may mean, depending on 
whether you access any
- * models in the action part of the request, that attachment and detachment of 
some models is done
- * twice for a request.</li>
- * <li>IRequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER. This option 
handles both the action-
- * and the render part of the request in one physical request, but instead of 
streaming the result
- * to the browser directly, it is kept in memory, and a redirect is issued to 
get this buffered
- * result (after which it is immediately removed). This option currently is 
the default render
- * strategy, as it shields you from the double submit problem, while being 
more efficient and less
- * error prone regarding to detachable models.</li>
- * </ul>
- * Note: In rare cases the strategies involving redirect may lose session 
data! For example: if
- * after the first phase of the strategy the server node fails without having 
the chance to
- * replicate the session then the second phase will be executed on another 
node and the whole
- * process will be restarted and thus anything stored in the first phase will 
be lost with the
- * failure of the server node. For similar reasons it is recommended to use 
sticky sessions when
- * using redirect strategies.</li>
- * </ul>
- * 
- * <p>
- * More documentation is available about each setting in the setter method for 
the property.
- * 
- * @author Igor Vaynberg (ivaynberg)
- */
-public interface IRequestCycleSettings
-{
-       /**
-        * Enum type for different render strategies
-        */
-       public enum RenderStrategy {
-               /**
-                * All logical parts of a request (the action and render part) 
are handled within the same
-                * request.
-                * <p>
-                * This strategy is more efficient than the 
'REDIRECT_TO_RENDER' strategy, and doesn't have
-                * some of the potential problems of it, it also does not solve 
the double submit problem.
-                * It is however the best option to use when you want to do 
sophisticated (non-sticky
-                * session) clustering.
-                * </p>
-                */
-               ONE_PASS_RENDER,
-
-               /**
-                * All logical parts of a request (the action and render part) 
are handled within the same
-                * request, but instead of streaming the render result to the 
browser directly, the result
-                * is cached on the server. A client side redirect command is 
issued to the browser
-                * specifically to render this request.
-                */
-               REDIRECT_TO_BUFFER,
-
-               /**
-                * The render part of a request (opposed to the 'action part' 
which is either the
-                * construction of a bookmarkable page or the execution of a 
IRequestListener handler) is
-                * handled by a separate request by issuing a redirect request 
to the browser. This is
-                * commonly known as the 'redirect after submit' pattern, 
though in our case, we use it for
-                * GET and POST requests instead of just the POST requests.
-                * <p>
-                * This pattern solves the 'refresh' problem. While it is a 
common feature of browsers to
-                * refresh/ reload a web page, this results in problems in many 
dynamic web applications.
-                * For example, when you have a link with an event handler that 
e.g. deletes a row from a
-                * list, you usually want to ignore refresh requests after that 
link is clicked on. By using
-                * this strategy, the refresh request only results in the 
re-rendering of the page without
-                * executing the event handler again.
-                * </p>
-                * <p>
-                * Though it solves the refresh problem, it introduces 
potential problems, as the request
-                * that is logically one, are actually two separate request. 
Not only is this less
-                * efficient, but this also can mean that within the same 
request attachment/ detachment of
-                * models is done twice (in case you use models in the 
bookmarkable page constructors and
-                * IRequestListener handlers). If you use this strategy, you 
should be aware of this
-                * possibility, and should also be aware that for one logical 
request, actually two
-                * instances of RequestCycle are created and processed.
-                * </p>
-                * <p>
-                * Also, even with this strategy set, it is ignored for 
instances of
-                * {@link 
org.apache.wicket.core.request.handler.BookmarkableListenerInterfaceRequestHandler},
-                * because otherwise they wouldn't be bookmarkable.
-                * </p>
-                */
-               REDIRECT_TO_RENDER
-       }
-
-       /**
-        * Adds a response filter to the list. Filters are evaluated in the 
order they have been added.
-        * 
-        * @param responseFilter
-        *            The {@link IResponseFilter} that is added
-        */
-       void addResponseFilter(IResponseFilter responseFilter);
-
-       /**
-        * Decides whether to buffer the response's headers until the end of 
the request processing.
-        * The buffering is needed if the application makes use of
-        * {@link 
org.apache.wicket.Component#setResponsePage(org.apache.wicket.Page)} or
-        * {@link org.apache.wicket.request.flow.ResetResponseException}
-        *
-        * @return {@code true} if the application should buffer the response's 
headers.
-        */
-       boolean getBufferResponse();
-
-       /**
-        * Gets whether Wicket should try to get extensive client info by 
redirecting to
-        * {@link BrowserInfoPage a page that polls for client capabilities}. 
This method is used by the
-        * default implementation of {@link 
org.apache.wicket.Session#getClientInfo()}, so if that method is
-        * overridden, there is no guarantee this method will be taken into 
account.
-        * 
-        * @return Whether to gather extensive client info
-        */
-       boolean getGatherExtendedBrowserInfo();
-
-       /**
-        * Gets in what way the render part of a request is handled.
-        * 
-        * @return the render strategy
-        */
-       IRequestCycleSettings.RenderStrategy getRenderStrategy();
-
-       /**
-        * @return an unmodifiable list of added response filters, null if none
-        */
-       List<IResponseFilter> getResponseFilters();
-
-       /**
-        * In order to do proper form parameter encoding it is important that 
the response and the
-        * subsequent request stipulate a common character encoding.
-        * 
-        * possible form encodings and their problems:
-        * 
-        * <ul>
-        * <li><a
-        * 
href="http://www.crazysquirrel.com/computing/general/form-encoding.jspx";>application/x-
-        * www-form-urlencoded</a></li>
-        * <li><a href=
-        * 
"http://stackoverflow.com/questions/546365/utf-8-text-is-garbled-when-form-is-posted-as-multipart-form-data";
-        * >multipart/form-data</a></li>
-        * </ul>
-        * 
-        * wicket now uses multipart/form-data for it's forms.
-        * 
-        * @return The request and response encoding
-        */
-       String getResponseRequestEncoding();
-
-       /**
-        * Gets the time that a request will by default be waiting for the 
previous request to be
-        * handled before giving up.
-        * 
-        * @return The time out
-        */
-       Duration getTimeout();
-
-       /**
-        * Sets a flag whether the application should buffer the response's 
headers until the end
-        * of the request processing. The buffering is needed if the 
application makes use of
-        * {@link 
org.apache.wicket.Component#setResponsePage(org.apache.wicket.Page)} or
-        * {@link org.apache.wicket.request.flow.ResetResponseException}
-        *
-        * @param bufferResponse
-        *            {@code true} if the application should buffer response's 
headers.
-        */
-       void setBufferResponse(boolean bufferResponse);
-
-       /**
-        * Sets whether Wicket should try to get extensive client info by 
redirecting to
-        * {@link BrowserInfoPage a page that polls for client capabilities}. 
This method is used by the
-        * default implementation of {@link 
org.apache.wicket.Session#getClientInfo()}, so if that method is
-        * overridden, there is no guarantee this method will be taken into 
account.
-        * 
-        * <p>
-        * <strong>WARNING: </strong> though this facility should work 
transparently in most cases, it
-        * is recommended that you trigger the roundtrip to get the browser 
info somewhere where it
-        * hurts the least. The roundtrip will be triggered the first time you 
call
-        * {@link Session#getClientInfo()} for a session, and after the 
roundtrip a new request with the
-        * same info (url, post parameters) is handled. So rather than calling 
this in the middle of an
-        * implementation of a form submit method, which would result in the 
code of that method before
-        * the call to {@link Session#getClientInfo()} to be executed twice, 
you best call
-        * {@link Session#getClientInfo()} e.g. in a page constructor or 
somewhere else where you didn't
-        * do a lot of processing first.
-        * </p>
-        * 
-        * @param gatherExtendedBrowserInfo
-        *            Whether to gather extensive client info
-        */
-       void setGatherExtendedBrowserInfo(boolean gatherExtendedBrowserInfo);
-
-       /**
-        * Sets in what way the render part of a request is handled. Basically, 
there are two different
-        * options:
-        * <ul>
-        * <li>Direct, ApplicationSettings.ONE_PASS_RENDER. Everything is 
handled in one physical
-        * request. This is efficient, and is the best option if you want to do 
sophisticated
-        * clustering. It does not however, shield you from what is commonly 
known as the <i>Double
-        * submit problem </i></li>
-        * <li>Using a redirect. This follows the pattern <a
-        * 
href="http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost"; 
>as described at
-        * the serverside </a> and that is commonly known as Redirect after 
post. Wicket takes it one
-        * step further to do any rendering after a redirect, so that not only 
form submits are shielded
-        * from the double submit problem, but also the IRequestListener 
handlers (that could be e.g. a
-        * link that deletes a row). With this pattern, you have two options to 
choose from:
-        * <ul>
-        * <li>ApplicationSettings.REDIRECT_TO_RENDER. This option first 
handles the 'action' part of
-        * the request, which is either page construction (bookmarkable pages 
or the home page) or
-        * calling a IRequestListener handler, such as Link.onClick. When that 
part is done, a redirect
-        * is issued to the render part, which does all the rendering of the 
page and its components.
-        * <strong>Be aware </strong> that this may mean, depending on whether 
you access any models in
-        * the action part of the request, that attachment and detachment of 
some models is done twice
-        * for a request.</li>
-        * <li>ApplicationSettings.REDIRECT_TO_BUFFER. This option handles both 
the action- and the
-        * render part of the request in one physical request, but instead of 
streaming the result to
-        * the browser directly, it is kept in memory, and a redirect is issue 
to get this buffered
-        * result (after which it is immediately removed). This option 
currently is the default render
-        * strategy, as it shields you from the double submit problem, while 
being more efficient and
-        * less error prone regarding to detachable models.</li>
-        * </ul>
-        * 
-        * @param renderStrategy
-        *            the render strategy that should be used by default.
-        */
-       void setRenderStrategy(IRequestCycleSettings.RenderStrategy 
renderStrategy);
-
-       /**
-        * In order to do proper form parameter decoding it is important that 
the response and the
-        * following request have the same encoding. see
-        * http://www.crazysquirrel.com/computing/general/form-encoding.jspx 
for additional information.
-        * 
-        * Default encoding: UTF-8
-        * 
-        * @param responseRequestEncoding
-        *            The request and response encoding to be used.
-        */
-       void setResponseRequestEncoding(final String responseRequestEncoding);
-
-       /**
-        * Sets the time that a request will by default be waiting for the 
previous request to be
-        * handled before giving up.
-        * 
-        * @param timeout
-        */
-       void setTimeout(Duration timeout);
-
-       /**
-        * Sets how many attempts Wicket will make to render the exception 
request handler before
-        *         giving up.
-        * @param retries
-        *      the number of attempts
-        */
-       void setExceptionRetryCount(int retries);
-
-       /**
-        * @return How many times will Wicket attempt to render the exception 
request handler before
-        *         giving up.
-        */
-       int getExceptionRetryCount();
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestCycleSettings.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestCycleSettings.java
 
b/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestCycleSettings.java
index 536102e..d631a7a 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestCycleSettings.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/settings/def/RequestCycleSettings.java
@@ -21,11 +21,56 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.wicket.response.filter.IResponseFilter;
-import org.apache.wicket.settings.IRequestCycleSettings;
 import org.apache.wicket.util.lang.Args;
 import org.apache.wicket.util.time.Duration;
 
 /**
+ * Interface for request related settings
+ * <p>
+ * <i>bufferResponse </i> (defaults to true) - True if the application should 
buffer responses. This
+ * does require some additional memory, but helps keep exception displays 
accurate because the whole
+ * rendering process completes before the page is sent to the user, thus 
avoiding the possibility of
+ * a partially rendered page.
+ * <p>
+ * <i>renderStrategy </i>- Sets in what way the render part of a request is 
handled. Basically,
+ * there are two different options:
+ * <ul>
+ * <li>Direct, IRequestCycleSettings.RenderStrategy.ONE_PASS_RENDER. 
Everything is handled in one
+ * physical request. This is efficient, and is the best option if you want to 
do sophisticated
+ * clustering. It does not however, shield you from what is commonly known as 
the <i>Double submit
+ * problem </i></li>
+ * <li>Using a redirect. This follows the pattern <a
+ * 
href="http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost"; 
>as described at the
+ * serverside </a> and that is commonly known as Redirect after post. Wicket 
takes it one step
+ * further to do any rendering after a redirect, so that not only form submits 
are shielded from the
+ * double submit problem, but also the IRequestListener handlers (that could 
be e.g. a link that
+ * deletes a row). With this pattern, you have two options to choose from:
+ * <ul>
+ * <li>IRequestCycleSettings.RenderStrategy.REDIRECT_TO_RENDER. This option 
first handles the
+ * 'action' part of the request, which is either page construction 
(bookmarkable pages or the home
+ * page) or calling a IRequestListener handler, such as Link.onClick. When 
that part is done, a
+ * redirect is issued to the render part, which does all the rendering of the 
page and its
+ * components. <strong>Be aware </strong> that this may mean, depending on 
whether you access any
+ * models in the action part of the request, that attachment and detachment of 
some models is done
+ * twice for a request.</li>
+ * <li>IRequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER. This option 
handles both the action-
+ * and the render part of the request in one physical request, but instead of 
streaming the result
+ * to the browser directly, it is kept in memory, and a redirect is issued to 
get this buffered
+ * result (after which it is immediately removed). This option currently is 
the default render
+ * strategy, as it shields you from the double submit problem, while being 
more efficient and less
+ * error prone regarding to detachable models.</li>
+ * </ul>
+ * Note: In rare cases the strategies involving redirect may lose session 
data! For example: if
+ * after the first phase of the strategy the server node fails without having 
the chance to
+ * replicate the session then the second phase will be executed on another 
node and the whole
+ * process will be restarted and thus anything stored in the first phase will 
be lost with the
+ * failure of the server node. For similar reasons it is recommended to use 
sticky sessions when
+ * using redirect strategies.</li>
+ * </ul>
+ *
+ * <p>
+ * More documentation is available about each setting in the setter method for 
the property.
+ *
  * @author Jonathan Locke
  * @author Chris Turner
  * @author Eelco Hillenius
@@ -35,8 +80,64 @@ import org.apache.wicket.util.time.Duration;
  * @author Martijn Dashorst
  * @author James Carman
  */
-public class RequestCycleSettings implements IRequestCycleSettings
+public class RequestCycleSettings
 {
+       /**
+        * Enum type for different render strategies
+        */
+       public static enum RenderStrategy {
+               /**
+                * All logical parts of a request (the action and render part) 
are handled within the same
+                * request.
+                * <p>
+                * This strategy is more efficient than the 
'REDIRECT_TO_RENDER' strategy, and doesn't have
+                * some of the potential problems of it, it also does not solve 
the double submit problem.
+                * It is however the best option to use when you want to do 
sophisticated (non-sticky
+                * session) clustering.
+                * </p>
+                */
+               ONE_PASS_RENDER,
+
+               /**
+                * All logical parts of a request (the action and render part) 
are handled within the same
+                * request, but instead of streaming the render result to the 
browser directly, the result
+                * is cached on the server. A client side redirect command is 
issued to the browser
+                * specifically to render this request.
+                */
+               REDIRECT_TO_BUFFER,
+
+               /**
+                * The render part of a request (opposed to the 'action part' 
which is either the
+                * construction of a bookmarkable page or the execution of a 
IRequestListener handler) is
+                * handled by a separate request by issuing a redirect request 
to the browser. This is
+                * commonly known as the 'redirect after submit' pattern, 
though in our case, we use it for
+                * GET and POST requests instead of just the POST requests.
+                * <p>
+                * This pattern solves the 'refresh' problem. While it is a 
common feature of browsers to
+                * refresh/ reload a web page, this results in problems in many 
dynamic web applications.
+                * For example, when you have a link with an event handler that 
e.g. deletes a row from a
+                * list, you usually want to ignore refresh requests after that 
link is clicked on. By using
+                * this strategy, the refresh request only results in the 
re-rendering of the page without
+                * executing the event handler again.
+                * </p>
+                * <p>
+                * Though it solves the refresh problem, it introduces 
potential problems, as the request
+                * that is logically one, are actually two separate request. 
Not only is this less
+                * efficient, but this also can mean that within the same 
request attachment/ detachment of
+                * models is done twice (in case you use models in the 
bookmarkable page constructors and
+                * IRequestListener handlers). If you use this strategy, you 
should be aware of this
+                * possibility, and should also be aware that for one logical 
request, actually two
+                * instances of RequestCycle are created and processed.
+                * </p>
+                * <p>
+                * Also, even with this strategy set, it is ignored for 
instances of
+                * {@link 
org.apache.wicket.core.request.handler.BookmarkableListenerInterfaceRequestHandler},
+                * because otherwise they wouldn't be bookmarkable.
+                * </p>
+                */
+               REDIRECT_TO_RENDER
+       }
+
        /** True if the response should be buffered */
        private boolean bufferResponse = true;
 
@@ -52,7 +153,7 @@ public class RequestCycleSettings implements 
IRequestCycleSettings
         * way in how a logical request that consists of an 'action' and a 
'render' part is handled, and
         * is mainly used to have a means to circumvent the 'refresh' problem.
         */
-       private IRequestCycleSettings.RenderStrategy renderStrategy = 
RenderStrategy.REDIRECT_TO_BUFFER;
+       private RequestCycleSettings.RenderStrategy renderStrategy = 
RenderStrategy.REDIRECT_TO_BUFFER;
 
        /** List of {@link IResponseFilter}s. */
        private List<IResponseFilter> responseFilters;
@@ -77,9 +178,11 @@ public class RequestCycleSettings implements 
IRequestCycleSettings
 // ****************************************************************************
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#addResponseFilter(IResponseFilter)
+        * Adds a response filter to the list. Filters are evaluated in the 
order they have been added.
+        *
+        * @param responseFilter
+        *            The {@link IResponseFilter} that is added
         */
-       @Override
        public void addResponseFilter(IResponseFilter responseFilter)
        {
                if (responseFilters == null)
@@ -90,36 +193,44 @@ public class RequestCycleSettings implements 
IRequestCycleSettings
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#getBufferResponse()
+        * Decides whether to buffer the response's headers until the end of 
the request processing.
+        * The buffering is needed if the application makes use of
+        * {@link 
org.apache.wicket.Component#setResponsePage(org.apache.wicket.request.component.IRequestablePage)}
 or
+        * {@link org.apache.wicket.request.flow.ResetResponseException}
+        *
+        * @return {@code true} if the application should buffer the response's 
headers.
         */
-       @Override
        public boolean getBufferResponse()
        {
                return bufferResponse;
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#getGatherExtendedBrowserInfo()
+        * Gets whether Wicket should try to get extensive client info by 
redirecting to
+        * {@link org.apache.wicket.markup.html.pages.BrowserInfoPage a page 
that polls for client capabilities}. This method is used by the
+        * default implementation of {@link 
org.apache.wicket.Session#getClientInfo()}, so if that method is
+        * overridden, there is no guarantee this method will be taken into 
account.
+        *
+        * @return Whether to gather extensive client info
         */
-       @Override
        public boolean getGatherExtendedBrowserInfo()
        {
                return gatherExtendedBrowserInfo;
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#getRenderStrategy()
+        * Gets in what way the render part of a request is handled.
+        *
+        * @return the render strategy
         */
-       @Override
-       public IRequestCycleSettings.RenderStrategy getRenderStrategy()
+       public RequestCycleSettings.RenderStrategy getRenderStrategy()
        {
                return renderStrategy;
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#getResponseFilters()
+        * @return an unmodifiable list of added response filters, null if none
         */
-       @Override
        public List<IResponseFilter> getResponseFilters()
        {
                if (responseFilters == null)
@@ -132,55 +243,130 @@ public class RequestCycleSettings implements 
IRequestCycleSettings
                }
        }
 
+
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#getResponseRequestEncoding()
+        * In order to do proper form parameter encoding it is important that 
the response and the
+        * subsequent request stipulate a common character encoding.
+        *
+        * possible form encodings and their problems:
+        *
+        * <ul>
+        * <li><a
+        * 
href="http://www.crazysquirrel.com/computing/general/form-encoding.jspx";>application/x-
+        * www-form-urlencoded</a></li>
+        * <li><a href=
+        * 
"http://stackoverflow.com/questions/546365/utf-8-text-is-garbled-when-form-is-posted-as-multipart-form-data";
+        * >multipart/form-data</a></li>
+        * </ul>
+        *
+        * wicket now uses multipart/form-data for it's forms.
+        *
+        * @return The request and response encoding
         */
-       @Override
        public String getResponseRequestEncoding()
        {
                return responseRequestEncoding;
        }
 
        /**
-        * @see org.apache.wicket.settings.IRequestCycleSettings#getTimeout()
+        * Gets the time that a request will by default be waiting for the 
previous request to be
+        * handled before giving up.
+        *
+        * @return The time out
         */
-       @Override
        public Duration getTimeout()
        {
                return timeout;
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#setBufferResponse(boolean)
+        * Sets a flag whether the application should buffer the response's 
headers until the end
+        * of the request processing. The buffering is needed if the 
application makes use of
+        * {@link 
org.apache.wicket.Component#setResponsePage(org.apache.wicket.request.component.IRequestablePage)}
+        * or {@link org.apache.wicket.request.flow.ResetResponseException}
+        *
+        * @param bufferResponse
+        *            {@code true} if the application should buffer response's 
headers.
         */
-       @Override
        public void setBufferResponse(boolean bufferResponse)
        {
                this.bufferResponse = bufferResponse;
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#setGatherExtendedBrowserInfo(boolean)
+        * Sets whether Wicket should try to get extensive client info by 
redirecting to
+        * {@link org.apache.wicket.markup.html.pages.BrowserInfoPage a page 
that polls for client capabilities}. This method is used by the
+        * default implementation of {@link 
org.apache.wicket.Session#getClientInfo()}, so if that method is
+        * overridden, there is no guarantee this method will be taken into 
account.
+        *
+        * <p>
+        * <strong>WARNING: </strong> though this facility should work 
transparently in most cases, it
+        * is recommended that you trigger the roundtrip to get the browser 
info somewhere where it
+        * hurts the least. The roundtrip will be triggered the first time you 
call
+        * {@link org.apache.wicket.Session#getClientInfo()} for a session, and 
after the roundtrip a new request with the
+        * same info (url, post parameters) is handled. So rather than calling 
this in the middle of an
+        * implementation of a form submit method, which would result in the 
code of that method before
+        * the call to {@link org.apache.wicket.Session#getClientInfo()} to be 
executed twice, you best call
+        * {@link org.apache.wicket.Session#getClientInfo()} e.g. in a page 
constructor or somewhere else where you didn't
+        * do a lot of processing first.
+        * </p>
+        *
+        * @param gatherExtendedBrowserInfo
+        *            Whether to gather extensive client info
         */
-       @Override
        public void setGatherExtendedBrowserInfo(boolean 
gatherExtendedBrowserInfo)
        {
                this.gatherExtendedBrowserInfo = gatherExtendedBrowserInfo;
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#setRenderStrategy(RenderStrategy)
+        * Sets in what way the render part of a request is handled. Basically, 
there are two different
+        * options:
+        * <ul>
+        * <li>Direct, ApplicationSettings.ONE_PASS_RENDER. Everything is 
handled in one physical
+        * request. This is efficient, and is the best option if you want to do 
sophisticated
+        * clustering. It does not however, shield you from what is commonly 
known as the <i>Double
+        * submit problem </i></li>
+        * <li>Using a redirect. This follows the pattern <a
+        * 
href="http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost"; 
>as described at
+        * the serverside </a> and that is commonly known as Redirect after 
post. Wicket takes it one
+        * step further to do any rendering after a redirect, so that not only 
form submits are shielded
+        * from the double submit problem, but also the IRequestListener 
handlers (that could be e.g. a
+        * link that deletes a row). With this pattern, you have two options to 
choose from:
+        * <ul>
+        * <li>ApplicationSettings.REDIRECT_TO_RENDER. This option first 
handles the 'action' part of
+        * the request, which is either page construction (bookmarkable pages 
or the home page) or
+        * calling a IRequestListener handler, such as Link.onClick. When that 
part is done, a redirect
+        * is issued to the render part, which does all the rendering of the 
page and its components.
+        * <strong>Be aware </strong> that this may mean, depending on whether 
you access any models in
+        * the action part of the request, that attachment and detachment of 
some models is done twice
+        * for a request.</li>
+        * <li>ApplicationSettings.REDIRECT_TO_BUFFER. This option handles both 
the action- and the
+        * render part of the request in one physical request, but instead of 
streaming the result to
+        * the browser directly, it is kept in memory, and a redirect is issue 
to get this buffered
+        * result (after which it is immediately removed). This option 
currently is the default render
+        * strategy, as it shields you from the double submit problem, while 
being more efficient and
+        * less error prone regarding to detachable models.</li>
+        * </ul>
+        *
+        * @param renderStrategy
+        *            the render strategy that should be used by default.
         */
-       @Override
-       public void setRenderStrategy(IRequestCycleSettings.RenderStrategy 
renderStrategy)
+       public void setRenderStrategy(RequestCycleSettings.RenderStrategy 
renderStrategy)
        {
                this.renderStrategy = renderStrategy;
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#setResponseRequestEncoding(java.lang.String)
+        * In order to do proper form parameter decoding it is important that 
the response and the
+        * following request have the same encoding. see
+        * http://www.crazysquirrel.com/computing/general/form-encoding.jspx 
for additional information.
+        *
+        * Default encoding: UTF-8
+        *
+        * @param encoding
+        *            The request and response encoding to be used.
         */
-       @Override
        public void setResponseRequestEncoding(final String encoding)
        {
                Args.notNull(encoding, "encoding");
@@ -188,22 +374,32 @@ public class RequestCycleSettings implements 
IRequestCycleSettings
        }
 
        /**
-        * @see 
org.apache.wicket.settings.IRequestCycleSettings#setTimeout(org.apache.wicket.util.time.Duration)
+        * Sets the time that a request will by default be waiting for the 
previous request to be
+        * handled before giving up.
+        *
+        * @param timeout
         */
-       @Override
        public void setTimeout(Duration timeout)
        {
                Args.notNull(timeout, "timeout");
                this.timeout = timeout;
        }
 
-       @Override
+       /**
+        * Sets how many attempts Wicket will make to render the exception 
request handler before
+        *         giving up.
+        * @param retries
+        *      the number of attempts
+        */
        public void setExceptionRetryCount(int retries)
        {
                this.exceptionRetryCount = retries;
        }
 
-       @Override
+       /**
+        * @return How many times will Wicket attempt to render the exception 
request handler before
+        *         giving up.
+        */
        public int getExceptionRetryCount()
        {
                return exceptionRetryCount;

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/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 73cdcc4..21be99c 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
@@ -41,7 +41,6 @@ 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;
@@ -123,7 +122,7 @@ import 
org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.IResource;
 import org.apache.wicket.request.resource.ResourceReference;
 import org.apache.wicket.session.ISessionStore.UnboundListener;
-import org.apache.wicket.settings.IRequestCycleSettings.RenderStrategy;
+import org.apache.wicket.settings.def.RequestCycleSettings.RenderStrategy;
 import org.apache.wicket.util.lang.Args;
 import org.apache.wicket.util.lang.Classes;
 import org.apache.wicket.util.lang.Generics;

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-core/src/test/java/org/apache/wicket/protocol/http/WebResponseExceptionsTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/protocol/http/WebResponseExceptionsTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/protocol/http/WebResponseExceptionsTest.java
index e5d17c9..cab51d0 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/protocol/http/WebResponseExceptionsTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/protocol/http/WebResponseExceptionsTest.java
@@ -20,8 +20,8 @@ import org.apache.wicket.WicketTestCase;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.markup.html.link.Link;
 import org.apache.wicket.markup.html.pages.PageExpiredErrorPage;
-import org.apache.wicket.settings.IRequestCycleSettings;
 import org.apache.wicket.settings.def.ExceptionSettings;
+import org.apache.wicket.settings.def.RequestCycleSettings;
 import org.junit.Test;
 
 
@@ -40,7 +40,7 @@ public class WebResponseExceptionsTest extends WicketTestCase
        {
                tester.getApplication()
                        .getRequestCycleSettings()
-                       
.setRenderStrategy(IRequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER);
+                       
.setRenderStrategy(RequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER);
                tester.getApplication()
                        .getExceptionSettings()
                        
.setUnexpectedExceptionDisplay(ExceptionSettings.SHOW_EXCEPTION_PAGE);

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-core/src/test/java/org/apache/wicket/request/handler/render/WebPageRendererTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/request/handler/render/WebPageRendererTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/request/handler/render/WebPageRendererTest.java
index 54e5f5f..79e7b31 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/request/handler/render/WebPageRendererTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/request/handler/render/WebPageRendererTest.java
@@ -36,7 +36,6 @@ import 
org.apache.wicket.core.request.handler.RenderPageRequestHandler;
 import 
org.apache.wicket.core.request.handler.RenderPageRequestHandler.RedirectPolicy;
 import org.apache.wicket.request.http.WebRequest;
 import org.apache.wicket.request.http.WebResponse;
-import org.apache.wicket.settings.IRequestCycleSettings;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -81,8 +80,8 @@ public class WebPageRendererTest
        }
 
        /**
-        * Tests that when {@link 
IRequestCycleSettings.RenderStrategy#ONE_PASS_RENDER} is configured
-        * there wont be a redirect issued
+        * Tests that when {@link 
org.apache.wicket.settings.def.RequestCycleSettings.RenderStrategy#ONE_PASS_RENDER}
+        * is configured there wont be a redirect issued
         */
        @Test
        public void testOnePassRender()
@@ -110,8 +109,8 @@ public class WebPageRendererTest
        }
 
        /**
-        * Tests that even when {@link 
IRequestCycleSettings.RenderStrategy#ONE_PASS_RENDER} is
-        * configured but the {@link RedirectPolicy} says that it needs to 
redirect it will redirect.
+        * Tests that even when {@link 
org.apache.wicket.settings.def.RequestCycleSettings.RenderStrategy#ONE_PASS_RENDER}
+        * is configured but the {@link RedirectPolicy} says that it needs to 
redirect it will redirect.
         */
        @Test
        public void testOnePassRenderWithAlwaysRedirect()
@@ -145,8 +144,8 @@ public class WebPageRendererTest
        }
 
        /**
-        * Tests that when {@link 
IRequestCycleSettings.RenderStrategy#ONE_PASS_RENDER} is configured
-        * but the current request is Ajax then a redirect should be issued
+        * Tests that when {@link 
org.apache.wicket.settings.def.RequestCycleSettings.RenderStrategy#ONE_PASS_RENDER}
+        * is configured but the current request is Ajax then a redirect should 
be issued
         */
        @Test
        public void testOnePassRenderAndAjaxRequest()
@@ -212,8 +211,8 @@ public class WebPageRendererTest
 
        /**
         * Tests that when the fromUrl and toUrl are the same and
-        * {@link IRequestCycleSettings.RenderStrategy#REDIRECT_TO_RENDER} is 
configured there wont be a
-        * redirect issued
+        * {@link 
org.apache.wicket.settings.def.RequestCycleSettings.RenderStrategy#REDIRECT_TO_RENDER}
+        * is configured there wont be a redirect issued
         */
        @Test
        public void testSameUrlsAndRedirectToRender()
@@ -378,8 +377,8 @@ public class WebPageRendererTest
        }
 
        /**
-        * Tests that when {@link 
IRequestCycleSettings.RenderStrategy#REDIRECT_TO_RENDER} is configured
-        * then no matter what are the fromUrl and toUrl a redirect will happen
+        * Tests that when {@link 
org.apache.wicket.settings.def.RequestCycleSettings.RenderStrategy#REDIRECT_TO_RENDER}
+        * is configured then no matter what are the fromUrl and toUrl a 
redirect will happen
         */
        @Test
        public void testRedirectToRender()

http://git-wip-us.apache.org/repos/asf/wicket/blob/813c022d/wicket-examples/src/main/java/org/apache/wicket/examples/library/LibraryApplication.java
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/library/LibraryApplication.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/library/LibraryApplication.java
index c9689eb..886735d 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/library/LibraryApplication.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/library/LibraryApplication.java
@@ -23,7 +23,7 @@ import 
org.apache.wicket.authorization.strategies.page.SimplePageAuthorizationSt
 import org.apache.wicket.examples.WicketExampleApplication;
 import org.apache.wicket.request.Request;
 import org.apache.wicket.request.Response;
-import org.apache.wicket.settings.IRequestCycleSettings.RenderStrategy;
+import org.apache.wicket.settings.def.RequestCycleSettings;
 
 
 /**
@@ -67,7 +67,7 @@ public final class LibraryApplication extends 
WicketExampleApplication
                super.init();
 
                getResourceSettings().setThrowExceptionOnMissingResource(false);
-               
getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_RENDER);
+               
getRequestCycleSettings().setRenderStrategy(RequestCycleSettings.RenderStrategy.REDIRECT_TO_RENDER);
 
                // Install a simple page authorization strategy, that checks 
all pages
                // of type AuthenticatedWebPage.

Reply via email to