Hi, I managed to hack wicket (1.4-m3) to do a kind of stateless ajax link.
I extended AbstractLink and implemented ILinkListener, and added a custom
stateless AjaxEventBehavior that creates a callback url using the
ILinkListener interface (in order to get a
BookmarkableListenerInterfaceRequestTarget).
In onLinkClicked, I create an AjaxRequestTarget and then call an abstract
handler.

This is already a nasty hack, however it doesn't work yet by itself.
BookmarkableListenerInterfaceRequestTarget.processEvents calls
getPage(requestCycle) if it can't find a page, and that method creates a new
page... but only if !requestCycle.isRedirect(). And isRedirect returns true
for ajax requests.
getPage is also final (why?) so I had to override processEvents to make it
work.
What does isRedirect mean anyway? And why is it true for all ajax requests?

After hacking that, the stateless ajax link worked, however when I tried to
add a stateful form to the page through it, it didn't work because the page
wasn't stored in the session. I had to use yet another hack - I called
getRequestCycle().urlFor(getPage()) because that seems to touch the page in
the session.

So everything seems to work now, however I don't like having to use these
hacks, and I wonder if I broke anything by using them (especially the page
creation on redirect). Is there any better way to do ajax stateless links?
Is wicket going to support that anytime soon?

Thanks
Adrian
-- 
View this message in context: 
http://www.nabble.com/Stateless-AJAX-links-tp20031309p20031309.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to