Hi,

I have a ModalWindow and want to redirect to a download of a shared resource 
if the user clicks ok (i.e. closes the window).

Currently, I am doing the following to achieve this, but Wicket produces a 
slightly wrong URL in the call to RequestCycle.urlFor():

setWindowClosedCallback(new WindowClosedCallback() {

  public void onClose(AjaxRequestTarget target) {
    ValueMap params = ...;
    ResourceReference reference = new ResourceReference("myResource");
    CharSequence redirectUrl = RequestCycle.get().urlFor(reference, params);
    IRequestTarget target = new RedirectRequestTarget(redirectUrl.toString());
    RequestCycle.get().setRequestTarget(target);
  }
}

This correctly closes the window and redirects afterwards, but the URL 
produced by the call to urlFor() starts with "../" because in 
ServletWebRequest.getRelativePathPrefixToWicketHandler() the if-statement 
looking for an Ajax-Request yields true (as the close request from the 
ModalWindow is an Ajax-Request) and then prepends the "../".

What would be the correct way to do this? Closing the modal window and 
redirecting to a shared resource afterwards.

Thanks in advance for any hints,
Timo

-- 
Timo B. Hübel
M.Sc.

freiheit.com technologies gmbh
Straßenbahnring 22 / 20251 Hamburg, Germany
fon +49 (0)40 / 890584-0
fax +49 (0)40 / 890584-20
HRB Hamburg 70814

38CC 735A AA87 7FA8 A18F 5050 579F 7EA6 C3B8 E81C
Geschäftsführer: Claudia Dietze, Stefan Richter, Jörg Kirchhof

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to