Where do these {myVar}s come from?

Sven

On 08/24/2012 03:32 PM, Guillaume Mary wrote:
Hi all,

Here is my use case: I need to fill variables, like {myVar}, that are rendered 
into the page. My approach is to use a specialized IResponseFilter for that. 
The important point is the filter should be applied to a certain Page of my 
application, and more of that, the variable values are picked up in this 
particular page (they are stored in a specific attribute of the page instance).

All was right in Wicket 1.4, I was able to check the targeted page in the 
IResponseFilter thanks to the code:
Page page = RequestCycle.get().getResponsePage();

Since Wicket 1.5, the getResponsePage() method disappeared, so I'm facing 
trouble to check (and get) my page.
I tried to replace the so simple getResponsePage() by some combination of 
overriden MountedMapper, WebPageRendered, BufferedResponseRequestHandler, or 
RequestCycle, etc, but I didn't manage to fill all the traps to ensure that all 
requests made by the user on the page are interpolated. Here is what I found:
- the first time the user opens the page seems to be treated by overriding 
WebPageRenderer.respond() and testing his 
renderPageRequestHandler.getPageClass()
- the Ajax case (user clicks on an ajax link on my page, I should interpolate 
the result response) seems to be treated by checking the result of 
PageInstanceMapper.mapRequest(..) to see if it's a IPageRequestHandler, then 
getting the page thru pageProvider
- the worst case is the redirecting one: the user click on a link that makes a 
setResponsePage(MyPage) then Wicket uses a temporary buffered response stored 
in WebApplication.storedResponse, then sends redirect to client, which recalls 
Wicket thats serves the cached response ! The second request doesn't contain 
the targeted Page because a BufferedResponseRequestHandler takes priority

Done all of that, the result is not always good, there are still unterpolated 
variables in my HTML.

It seems to be so complicated that I'm asking myself if i'm on the good way.
Does anyone can help me accomplish my use case ? (a good knowledge of wicket 
1.5 request handling seems to be necessary !)

Thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to