You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Thorsten Schöning (JIRA)" <ji...@apache.org> on 2016/03/07 16:26:40 UTC

[jira] [Updated] (WICKET-6111) Empty redirect on redirect to home page if home page already shown

     [ https://issues.apache.org/jira/browse/WICKET-6111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thorsten Schöning updated WICKET-6111:
--------------------------------------
    Attachment: empty_redirect.zip

Quickstart added

> Empty redirect on redirect to home page if home page already shown
> ------------------------------------------------------------------
>
>                 Key: WICKET-6111
>                 URL: https://issues.apache.org/jira/browse/WICKET-6111
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.2.0
>         Environment: Windows 8.1 x86-64, Tomcat 7.0.67
>            Reporter: Thorsten Schöning
>         Attachments: empty_redirect.zip
>
>
> Wicket seems to produce an empty redirect if a user already opened the home page of an app and gets redirected to the same page by e.g. clicking a link containing the following line:
> {CODE}
> RequestCycle.get().setResponsePage(Application.get().getHomePage(), ...);
> {CODE}
> In my case the purpose of the link is to sign out and redirect all users to a well known page afterwards. Involved URLs:
> {CODE}
> http://localhost:8080/org.example.frontend/?0
> http://localhost:8080/org.example.frontend/?0-1.ILinkListener-home.signOut
> {CODE}
> In this case Wicket creates an empty target URL for a redirect and sends that to my Tomcat 7, which seem to just forward it to the browser, which does nothing. The result is that the user sits on a white page and needs to refresh manually using e.g. F5. In contrast with a qucikstart containing and embedded Jetty, Wicket generates the exact same empty target URL but Jetty seem to resolve it internally to a absolut URL and therefore the requests succeeds now.
> Example from the browser using Tomcat 7:
> {CODE}
> Request URL:http://localhost:8081/org.example.frontend/?3-1.ILinkListener-html-body-pnNav-home.signOut
> Request Method:GET
> Status Code:302 Found
> Remote Address:127.0.0.1:8081
> Cache-Control:no-cache, no-store
> Content-Length:0
> Date:Sun, 06 Mar 2016 19:34:40 GMT
> Expires:Thu, 01 Jan 1970 00:00:00 GMT
> Location:
> Pragma:no-cache
> Server:Apache-Coyote/1.1
> Set-Cookie:JSESSIONID=[...]; Path=/org.example.frontend/; HttpOnly
> {CODE}
> And from Jetty:
> {CODE}
> Request URL:http://localhost:8080/org.example.frontend/?0-1.ILinkListener-home.signOut
> Request Method:GET
> Status Code:302 Found
> Remote Address:[::1]:8080
> Response Headers
> view source
> Cache-Control:no-cache, no-store
> Content-Length:0
> Date:Mon, 07 Mar 2016 15:12:40 GMT
> Expires:Thu, 01 Jan 1970 00:00:00 GMT
> Location:http://localhost:8080/org.example.frontend/
> Pragma:no-cache
> Server:Jetty(9.2.13.v20150730)
> {CODE}
> Debugging lead to org.apache.wicket.protocol.http.servlet.ServletWebResponse#encodeRedirectURL and #sendRedirect:
> This function behaves (nearly) the same for my URLs, the only difference is the following line:
> {CODE}
> Url originalUrl = Url.parse(url);
> {CODE}
> In my Tomcat I get a completely empty object, NOT null though, in the quickstart with Jetty I get an object containing ".". But in the end that doesn't seem to make any difference, both requests go through the following:
> {CODE}
> if (fullUrl.equals(encodedFullUrl))
> {
>         // no encoding happened so just reuse the original url
>         encodedUrl = url.toString();
> }
> {CODE}
> encodedUrl is "./" using Tomcat and Jetty as well, while "fullUrl" contains an absolute URL in both cases:
> {CODE}
> http://localhost:8080/org.example.frontend/
> {CODE}
> "./" is returned to ServletWebResponse.sendRedirect and runs into the following:
> {CODE}
> if (url.startsWith("./"))
> {
>         /*
>          * WICKET-4260 Tomcat does not canonalize urls, which leads to problems with IE
>          * when url is relative and starts with a dot
>          */
>         url = url.substring(2);
> }
> {CODE}
> And that empties my URL and forwards it to the servlet container, where Jetty instead of Tomcat seems to provide some magic to respond with an absolute URL in the end. But my debugger says that in both cases
> {CODE}
> httpServletResponse.sendRedirect(url);
> {CODE}
> gets called with an empty string.



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