Re: Proper hook for conversational state that also works with tests
Thanks Igor, I created https://issues.apache.org/jira/browse/WICKET-2090 igor.vaynberg wrote: > > the problem is wicket tester doesnt run wicket through the entire > web-request workflow and you are hooking into a part that is not being > hit. i have a good idea of where to add an extension point, please > open a jira issue so i can attach a patch there and you can see if it > will work for you. > > -igor > -- View this message in context: http://www.nabble.com/Proper-hook-for-conversational-state-that-also-works-with-tests-tp21876375p21911364.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Proper hook for conversational state that also works with tests
> On Fri, Feb 6, 2009 at 9:06 AM, cpopetz wrote: > > This works great when running in-container, but isn't playing well with > > tests that use ajax. When an ajax link is clicked in-container, the full > > request cycle is step()ed through. But BaseWicketTester.clickLink(), which > > I presume is the appropriate thing to use, does: By the way, I use executeAjaxEvent("onclick") with ajax links instead of clickLink(). But probably that doesn't call resolve() either. Best wishes, Timo - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Proper hook for conversational state that also works with tests
the problem is wicket tester doesnt run wicket through the entire web-request workflow and you are hooking into a part that is not being hit. i have a good idea of where to add an extension point, please open a jira issue so i can attach a patch there and you can see if it will work for you. -igor On Fri, Feb 6, 2009 at 9:06 AM, cpopetz wrote: > > Hi, > > I'm currently responsible for maintaining the Seam/Wicket integration for > the Seam team. Seam maintains a "conversational" context, a session-based > map that is keyed by an id associated with a set of requests. Previously > the wicket integration worked by wrapping every redirect or outgoing url and > adding the conversation id as a parameter, and then restoring the > conversation based on that parameter in a servlet filter. While this works, > it's ugly, and doesn't play with with various URL coding strategies. > > So instead, I've been working on storing the conversational id in Page > metadata. I did this by providing a new WebRequestCycleProcessor subclass > which in resolve() looks for IPageRequestTarget or > BookmarkablePageRequestTarget, pulls the page out, and restores the > conversation if the parameter is present in metdata. Correspondingly, in > respond(), I do the inverse. > > This works great when running in-container, but isn't playing well with > tests that use ajax. When an ajax link is clicked in-container, the full > request cycle is step()ed through. But BaseWicketTester.clickLink(), which > I presume is the appropriate thing to use, does: > >AjaxLink link = (AjaxLink)linkComponent; > >setupRequestAndResponse(true); >WebRequestCycle requestCycle = createRequestCycle(); >callOnBeginRequest(requestCycle); >AjaxRequestTarget target = new > AjaxRequestTarget(link.getPage()); >requestCycle.setRequestTarget(target); > >link.onClick(target); > >// process the request target >processRequestCycle(requestCycle); > > > This means that the link's onClick method is called before my request cycle > hooks have a chance to restore conversational state. > > Is there an alternate way I should be hooking into wicket so that I can > reliably intercept requests to pages and retrieve/store metadata? > > Thank you, > -Clint > -- > View this message in context: > http://www.nabble.com/Proper-hook-for-conversational-state-that-also-works-with-tests-tp21876375p21876375.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Proper hook for conversational state that also works with tests
Hi, I'm currently responsible for maintaining the Seam/Wicket integration for the Seam team. Seam maintains a "conversational" context, a session-based map that is keyed by an id associated with a set of requests. Previously the wicket integration worked by wrapping every redirect or outgoing url and adding the conversation id as a parameter, and then restoring the conversation based on that parameter in a servlet filter. While this works, it's ugly, and doesn't play with with various URL coding strategies. So instead, I've been working on storing the conversational id in Page metadata. I did this by providing a new WebRequestCycleProcessor subclass which in resolve() looks for IPageRequestTarget or BookmarkablePageRequestTarget, pulls the page out, and restores the conversation if the parameter is present in metdata. Correspondingly, in respond(), I do the inverse. This works great when running in-container, but isn't playing well with tests that use ajax. When an ajax link is clicked in-container, the full request cycle is step()ed through. But BaseWicketTester.clickLink(), which I presume is the appropriate thing to use, does: AjaxLink link = (AjaxLink)linkComponent; setupRequestAndResponse(true); WebRequestCycle requestCycle = createRequestCycle(); callOnBeginRequest(requestCycle); AjaxRequestTarget target = new AjaxRequestTarget(link.getPage()); requestCycle.setRequestTarget(target); link.onClick(target); // process the request target processRequestCycle(requestCycle); This means that the link's onClick method is called before my request cycle hooks have a chance to restore conversational state. Is there an alternate way I should be hooking into wicket so that I can reliably intercept requests to pages and retrieve/store metadata? Thank you, -Clint -- View this message in context: http://www.nabble.com/Proper-hook-for-conversational-state-that-also-works-with-tests-tp21876375p21876375.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org