[
https://issues.apache.org/jira/browse/WICKET-6337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15923099#comment-15923099
]
Marcel Barbosa Pinto commented on WICKET-6337:
----------------------------------------------
I can't cast the class if I set a custom class because it looses my instance.
When the #getPageManager() returns
pageAccessSynchronizer.get().adapt(pageManager), another instance is created
and decorated with the custom class inside it.
So I can't cast it back to my custom class, this gives me a class cast
exception:
((MyCustomPageStoreManager)
getSession().getPageManager()).removePage(getPage());
The custom class is added to the application like this:
setPageManagerProvider(new MyCustomPageManagerProvider(this));
And inside its #get() I return the MyCustomPageStoreManager class
I can create a quick start if needed.
Thanks.
> Wrong class type in PageAccessSynchronizer
> ------------------------------------------
>
> Key: WICKET-6337
> URL: https://issues.apache.org/jira/browse/WICKET-6337
> Project: Wicket
> Issue Type: Bug
> Reporter: Marcel Barbosa Pinto
> Assignee: Martin Grigorov
> Fix For: 8.0.0-M5
>
>
> If you do this:
> {noformat}
> IPageManager pageManager = getSession().getPageManager();
> System.out.println("------>" + pageManager.toString());
> {noformat}
> It will return PageAccessSynchronizer instead IPageManager:
> {noformat}
> ------>org.apache.wicket.page.PageAccessSynchronizer$2@38834c7b
> {noformat}
> So I can't cast this to my custom class that extends IPageManager
> *org.apache.wicket.page.Session.java*
> {noformat}
> public final IPageManager getPageManager()
> {
> IPageManager pageManager =
> Application.get().internalGetPageManager();
> return pageAccessSynchronizer.get().adapt(pageManager);
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)