Sorry, I missed this thread in my daily reading of the list! Will post my thoughts in the JIRA issue.
Thanks! On Fri, Aug 8, 2014 at 2:22 PM, Martin Grigorov <[email protected]> wrote: > See http://markmail.org/message/njv2rnsdco6uihea > > > On Fri, Aug 8, 2014 at 2:18 PM, Guillaume Smet <[email protected]> > wrote: > >> Hi, >> >> We have a really annoying problem for some time in one of our Wicket >> applications. >> >> When a stateful page is expired, Wicket tries to rerender the page >> (nice!) but without the PageParameters (not nice: our page needs the >> parameter to be rendered). >> >> The pageParameters are set to null if there is a page id in >> processListener: >> // WICKET-4594 - ignore the parsed parameters for stateful pages >> pageParameters = null; >> >> It looks like it's something wanted as it's supposed to fix a bug but >> I don't really understand why we would want that. >> >> As it looks like a tricky subject and I'm not sure we can find a good >> compromise for everyone, I'm working on a local workaround to fix it >> locally. I'm pretty sure people might be interested in a valid >> workaround for this issue. >> >> I was wondering if using something like: >> @Override >> protected IRequestHandler processListener(PageComponentInfo >> pageComponentInfo, >> Class<? extends IRequestablePage> pageClass, >> PageParameters pageParameters) { >> PageParameters currentRequestPageParameters = new >> PageParameters(pageParameters); >> >> IRequestHandler handler = >> super.processListener(pageComponentInfo, pageClass, pageParameters); >> >> if (handler instanceof ListenerInterfaceRequestHandler) { >> ListenerInterfaceRequestHandler listenerPageHandler = >> (ListenerInterfaceRequestHandler) handler; >> >> if (listenerPageHandler.getPageParameters() == null && >> currentRequestPageParameters != null && >> currentRequestPageParameters.getNamedKeys().size() > 0) { >> PageProvider provider = new PageProvider(pageClass, >> currentRequestPageParameters); >> provider.setPageSource(getContext()); >> handler = new RenderPageRequestHandler(provider, >> RedirectPolicy.ALWAYS_REDIRECT); >> } >> } >> >> return handler; >> } >> in a MountedMapper could do the trick? >> >> > Can you give us a diff instead ? > It is hard to spot the change. > > >> It works as far as I can test it but I'm wondering if there might be >> something fishy there or side effects I should be aware of. >> >> We are using the PageParameterAwareMountedMapper of Johannes [1] and >> there's a comment in the code I can't really explain: >> // This check is necessary to prevent a >> // RestartResponseAtInterceptPageException at the wrong >> time in >> // request cycle >> if (provider.hasPageInstance()) { >> >> In my case, I won't have a page instance as the page is expired and I >> don't see why the processListener method could be called twice but I >> think it might be worth asking for advice. >> >> Thanks for your feedback. >> >> [1] >> https://github.com/unterstein/wicket-tales/blob/master/src/main/java/org/wickettales/request/mapper/PageParameterAwareMountedMapper.java >>
