I am using:

 

            throw new RedirectUrlException(externalUrl);

 

to redirect to an external URL (i.e.
https://hostname/path?param1=value1&param2=value2 etc.,)

 

In constructing the URL I have used java.net.URLEncoder.encode() to
individual encode the values in each of the query parameters.

 

The browser shows the redirected URL with the query parameters being
'decoded' not encoded.

 

I stepped through in the debugger and saw that Wicket's
org.apache.wicket.util.encoding.UrlDecoder is being used to decode the
URL while processing the redirect.

 

 

I worked around problem by using the native Servlet API redirect:

 

            HttpServletResponse response =
(HttpServletResponse)getRequestCycle().getResponse().getContainerRespons
e();

            try

            {

                        response.sendRedirect(url);

            }

            catch(IOException ioe)

            {

                        logger.error("Error while attempting to redirect
to: " + url);

            }

 

However, is there a 'Wicket' way of redirecting to an external URL
without causing the undesired decoding?

 

 

Note: Using Wicket 6.x

 

Regards,

Chris

Reply via email to