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

Erik Godding Boye commented on WICKET-3554:
-------------------------------------------

I think this issue should be reopened. Let me try to explain why:

I am trying to pass a reference to the referring page, to a bookmarkable page, 
using a BookmarkablePageLink. The reference is later used to direct the user 
back to the referring page (if it still exists).
Because of the non-public constructor in PageReference, there is no way to 
reconstruct the object based on the PageParameters passed to the bookmarkable 
page.

Of course I have to deal with the possibility that the referring page no longer 
exist, but I guess in that case, PageReference#getPage will return null.

As a workaround, I store the pageId as a reference to the referring page in the 
bookmarkable page, and copied the code in PageReference#getPage. It works, but 
it is definitely not an ideal solution.

I you are worried about creating references to non-existing pages, you could 
add some kind of validating factory method - that verifies the page existence 
(using the same code as in PageReference#getPage).
                
> Constructor of org.apache.wicket.PageReference should be public
> ---------------------------------------------------------------
>
>                 Key: WICKET-3554
>                 URL: https://issues.apache.org/jira/browse/WICKET-3554
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.4.15
>            Reporter: Thomas Götz
>            Priority: Minor
>
> The construcor of PageReference is not accessible (no qualifier, proteced). 
> Is this for a reason? As far as I can see, a public qualifier would be nice 
> as I rather often created an own class with a similar implementation (because 
> I could not create an instance of PageReference).

--
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