[ 
https://issues.apache.org/jira/browse/WICKET-4441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262510#comment-13262510
 ] 

Tsutomu YANO commented on WICKET-4441:
--------------------------------------

Does my understanding of this issue right? My understanding is following.

If users access a page through a url like /wicket/page?0, PageInstanceMapper 
try to restore the page from pageStore with the pageId. In this time, the 
PageParameter passed to a PageProvider is empty, so checking equality of 
PageParameters fail and new instance of page is created always. In this case, 
some events which use url like '/wicket/page?0' do not act correctly because 
new Page instance is created always though events must be post-backed into the 
same page rendered before events.

So, I propose that PageProvider class should have a new constructor argument 
like 'isPageMountedToUrl'. MountedMapper and other same kind of Mappers should 
pass 'true' for the argument, because a page is mounted onto a URL defined by 
programmer. PageInstanceMapper should pass 'false', because the url which 
PageInstanceMapper handle is not user-defined mount-url.

For API-compatibility, PageProvider must have all old (original) constructors. 
These constructors should set 'true' to the value of 'isPageMountedToUrl'. Some 
special IRequestMappers (probably only PageInstanceMapper) should set 'false'.

By holding this argument into a field, we can determine to check equality of 
PageParameters or not.

It just an idea. not implemented yet. How do you think about this idea? If you 
give +1 to this idea, I will try to implement the idea.
                
> PageProvider should create a new Page instance if PageParameters are changed, 
> even if a stored page exists.
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4441
>                 URL: https://issues.apache.org/jira/browse/WICKET-4441
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.5
>         Environment: all platform.
>            Reporter: Tsutomu YANO
>            Assignee: Martin Grigorov
>             Fix For: 1.5.6, 6.0.0-RC1
>
>         Attachments: WICKET-4441.patch, fix-WICKET-4441.patch, 
> pagebug.tar.gz, pagebug2.tar.gz
>
>
> The 'getStoredPage(int)' method returns a stored page instance even if user 
> changes parameter values encoded into URL, and the PageParameters object of 
> the stored page instance is never changed. So same page is displayed always 
> though user changes url on browser manually.
> ** HOW TO REPRODUCT **
> 1. unpack the attached sample project 'pagebug.tar.gz'.
> 2. mvn jetty:run
> 3. access to http://localhost:8080/user/user1
> You will see a form filled with information about user 1. The user's name is 
> 'user 1', age is 30 and country is 'Japan'.
> The mount path of this page is '/user/${userId}'. so 'user1' in the accessed 
> url is a parameter value.
> after accessing to the url, the url will be changed to 
> http://localhost:8080/user/user1?0 .  it contains the page id of the 
> currently displayed page.
> 4. change some values and submit the form. page id will be changed on every 
> submit.
> 5. change only parameter value in url to 'user2'. Never change page-id.
> for example, if you now access to http://localhost:8080/user/user1?5, change 
> the url to http://localhost:8080/user/user2?5 .
> 6. This program must display information about user2, because the parameter 
> value of url is changed. But you will see the information of user 1. Wicket 
> always display the page of page-id = 5 (even though user changed url 
> manually).
> In this sample program, I use LoadableDetachableModel for retrieving current 
> parameter-value. But I don't get the new parameter-value because 
> pageParameters object in a page instance is never changed after the 
> construction. pageParameters is fixed in the constructor of Page class.
> I think that there are no easy way to retrieve parameter-values encoded into 
> mount-path. Request.getRequestParameters() does not contain parameters 
> encoded into mount-path. So there are no work-around for this issue.
> ** HOW TO FIX THIS ISSUE **
> We must return null from getStoredPage(int) method of PageProvider class, if 
> current PageParameters is not same with the PageParameters of a stored page. 
> In current code, getStoredPage(int) checks only if the class of both pages 
> are same. We must check the PageParameters of both pages.
> ** PATCH **
> I attached a pache for PageProvider class. try it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to