You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Ivan Shestakov (JIRA)" <ji...@apache.org> on 2016/03/20 13:52:35 UTC

[jira] [Commented] (WICKET-1864) MockHttpServletRequest does not support absolute redirection URLs.

    [ https://issues.apache.org/jira/browse/WICKET-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15203285#comment-15203285 ] 

Ivan Shestakov commented on WICKET-1864:
----------------------------------------

1.4.23 still not fixed.

Buggy code: 
{noformat}
		// We need to absolutize the redirect URL as we are not as smart as a web-browser
		// (WICKET-702)
		url = redirect;
		if ((url.length() == 0) || (url.charAt(0) != '/'))
		{
			url = getContextPath() + getServletPath() + "/" + redirect;
		}
{noformat}

When I have absolute redirect url = http://path/to/?query I get the following url = /TestApp/TestApp/http://path/to/?query

> MockHttpServletRequest does not support absolute redirection URLs.
> ------------------------------------------------------------------
>
>                 Key: WICKET-1864
>                 URL: https://issues.apache.org/jira/browse/WICKET-1864
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-M3
>            Reporter: Maarten Billemont
>            Assignee: Igor Vaynberg
>         Attachments: Wicket-Quickstart.zip
>
>
> Using the sendRedirect(String) method on an MockHttpServletRequest object causes bugged behaviour when the URL that is passed is absolute.
> The following code needs to change (line 1277):
> 		// We need to absolutize the redirect URL as we are not as smart as a web-browser
> 		// (WICKET-702)
> 		url = getContextPath() + getServletPath() + "/" + redirect;
> into, for example:
> 		// We need to absolutize the redirect URL as we are not as smart as a web-browser
> 		// (WICKET-702)
> 		url = redirect.charAt(0) == '/' ? redirect : redirect. getContextPath() + getServletPath() + "/" + redirect;
> After a few redirects I end up at:
> /BankApplication/BankApplication//BankApplication
> Which is not where I want to be.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)