A proof : https://issues.apache.org/jira/browse/WICKET-3758

What is the actual meaning of "versioned" ? Should not be stored or
should not stored more than one version of this page ?

On Wed, Jun 1, 2011 at 10:24 AM, Martin Grigorov <[email protected]> wrote:
> Hi,
>
> Yesterday while playing with the app from
> http://www.jtict.com/blog/rails-wicket-grails-play-lift-jsp I found
> that org.apache.wicket.page.PageAccessSynchronizer.lockPage(int) is
> called as many times as PageProvider#getPage() is used.
> So I did the following optimization:
>
> Index: 
> wicket-core/src/main/java/org/apache/wicket/request/handler/PageProvider.java
> ===================================================================
> --- 
> wicket-core/src/main/java/org/apache/wicket/request/handler/PageProvider.java 
>       (revision
> 1130015)
> +++ 
> wicket-core/src/main/java/org/apache/wicket/request/handler/PageProvider.java 
>       (working
> copy)
> @@ -158,12 +158,13 @@
>                if (pageInstance == null)
>                {
>                        pageInstance = getPageInstance(pageId, pageClass, 
> pageParameters,
> renderCount);
> +                       if (pageInstance == null)
> +                       {
> +                               throw new PageExpiredException("Page 
> expired.");
> +                       }
> +                       touchPageInstance(pageInstance);
>                }
> -               if (pageInstance == null)
> -               {
> -                       throw new PageExpiredException("Page expired.");
> -               }
> -               touchPageInstance(pageInstance);
> +
>                return pageInstance;
>        }
>
> I.e. check whether to throw PageExpiredException or touch the page
> only when it was just attempted to read from the page store, all
> following calls to #getPage() work with the cached page (already
> touched).
> Everything is OK but just one test fails :
> org.apache.wicket.ajax.InternalErrorCallsAjaxOnFailureTest.showsInternalErrorPage()
> The problem is that
> org.apache.wicket.markup.html.pages.ExceptionErrorPage.isVersioned()
> returns false and this error page should not be stored.
> org.apache.wicket.Page.dirty(boolean) takes into account isVersioned()
> but 
> org.apache.wicket.request.handler.PageProvider.touchPageInstance(IRequestablePage)
> doesn't and always marks the page as candidate for storing.
>
> If above is a bug I suggest to add IManageblePage#dirty(boolean) and
> use it instead session.getPageManager().touchPage(IRequestablePage).
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Reply via email to