On Thu, Apr 26, 2012 at 12:50 PM, Jürgen Lind <[email protected]> wrote:
> Thanks for the quick responses... First of all the code sample: in my
> LoginPanel
> I have a method that is invoked if the user authentication succeeds:
>
>      protected void onSuccess(AuthenticatedUser user, AjaxRequestTarget
> target) {
>        EmobWebSession.get().setAuthenticatedUser(user);
>
>        if (!LoginPage.this.continueToOriginalDestination()) {
>          PageParameters pp = new PageParameters();
>          pp.add("page", "fleetlist");
>          setResponsePage(new DesktopPage(pp));

There is a small but important difference between
setResponsePage(Page) and setResponsePage(Class).
In most cases I'd recommend to use the Class variant because it
produces nicer urls if the page class is mounted.

What should happen in your case:
by using the Page variant Wicket will render DesktopPage in the Ajax
request, will store a BufferedWebResponse for it in the Application
and will do a redirect to url like ../wicket/page?pageId. The redirect
will be done as I explained in my previous mail - by returning
<ajax-response<redirect>...</></> and reload the page with:
document.location=.../wicket/page?pageId. This request will be handled
by BufferedResponseMapper because it will find stored response for
that url.

>        }
>      }
>
> this code leads me to the root context of the server... Oddly enough, I do
> not see a
> redirect reponse neither in firebug nor in TamperData...
>
> If I replace the setResponsePage call with the following code, everything
> works just
> fine:
>          getRequestCycle().scheduleRequestHandlerAfterCurrent(
>              new RedirectRequestHandler("/desktop"));
>
> Is that a valid approach to achieving my goal or ist this just voodoo
> programming?
>
> J.
>
>
>
> On 26.04.2012 11:28, Martin Grigorov wrote:
>>
>> Hi Juergen,
>>
>> This scenario should work just fine.
>> Wicket returns<redirect>./some/relative/url</redirect>  in the Ajax
>> response and uses window.location=url to do the "redirect"
>> Please try with 1.5.5 and create a ticket with a quickstart if it
>> still fails for you.
>>
>> On Thu, Apr 26, 2012 at 12:05 PM, Jürgen Lind<[email protected]>
>>  wrote:
>>>
>>> Hi,
>>>
>>> I have difficulties in using the setResponsePage in ajax call as Wicket
>>> seems to direct the
>>> call to a relative URL. As a result, the request is made to the root
>>> context
>>> an that gives me
>>> a 404.
>>>
>>> The scenario is as follows: I have a login form and would like to provide
>>> user feedback on
>>> submission errors as ajax responses. Upon success, the user should be
>>> redirected to a new
>>> page.
>>>
>>> I have already found a thread on a similar issue and there it said, that
>>> this was fixed in 1.4.7.
>>> As I am using 1.5.3 this should presumably work. Am I doing something
>>> wrong
>>> here?
>>>
>>> Cheers,
>>>
>>> Jürgen
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>
>>
>>
>
>
> --
> Mit freundlichen Grüßen,
>
> Jürgen Lind
>
> --
> Dr. Jürgen Lind
> iteratec GmbH                Fon: +49 (0)89 614551-44
> Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
> 82008 Unterhaching           Web: www.iteratec.de
>
> Sitz und Registergericht der iteratec GmbH: München HRB 113 519
> Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to