Hi,

It seems you use RedirectToUrlException(String) constructor which
internally uses statusCode=HttpServletResponse.SC_MOVED_TEMPORARILY.
If you use RedirectToUrlException(yourUrl,
HttpServletResponse.SC_SEE_OTHER) then Wicket will not do its extra logic
in 
org.apache.wicket.protocol.http.servlet.ServletWebResponse#encodeRedirectURL()
and all should be fine.

On Mon, Feb 25, 2019 at 8:13 PM Chris Colman <chr...@stepaheadsoftware.com>
wrote:

> 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