You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Andrew Klochkov (JIRA)" <ji...@apache.org> on 2007/08/15 10:33:30 UTC

[jira] Created: (WICKET-847) setResponsePage redirects to wrong url

setResponsePage redirects to wrong url
--------------------------------------

                 Key: WICKET-847
                 URL: https://issues.apache.org/jira/browse/WICKET-847
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.0-beta2
            Reporter: Andrew Klochkov
         Attachments: wicket-quickstart.tar.gz

When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Bille Jensen updated WICKET-847:
--------------------------------------

    Fix Version/s:     (was: 1.3.0-rc2)
                   1.3.0-rc3

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-rc3
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-847.
----------------------------------

    Resolution: Cannot Reproduce
      Assignee: Igor Vaynberg  (was: Alastair Maw)

started the quickstart, clicked the link, everything seems to work in ff and ie

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.5
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw updated WICKET-847:
--------------------------------

    Fix Version/s: 1.3.0-rc1

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-rc1
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539969 ] 

Alastair Maw commented on WICKET-847:
-------------------------------------

Tomcat is evidently lacking in the relative to absolute URL conversion on the 302 redirect here. We should probably just do it ourselves and not rely on one of the slightly more esoteric bits of the servlet-api spec for it.

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-rc2
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Andrew Klochkov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523607 ] 

Andrew Klochkov commented on WICKET-847:
----------------------------------------

A better workaround which solves some issues is to return "." instead of empty string. 

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-rc1
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Martijn Dashorst (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martijn Dashorst updated WICKET-847:
------------------------------------

    Fix Version/s:     (was: 1.3.4)
                   1.3.5

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.5
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-847.
----------------------------------

    Resolution: Fixed

just noticed matijn did commit the code mentioned in the comments, albeit silently. that is why it worked when i tried it.

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Martijn Dashorst
>             Fix For: 1.4-M3, 1.3.5
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Vjacheslav Kanivetc (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659794#action_12659794 ] 

Vjacheslav Kanivetc commented on WICKET-847:
--------------------------------------------

This patch is NOT included in 1.3.5, so fix for version is incorrect. I think it should be reapplied to 1.3.6 version at least.

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Martijn Dashorst
>             Fix For: 1.3.5, 1.4-M3
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Andrew Klochkov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Klochkov updated WICKET-847:
-----------------------------------

    Attachment: wicket-quickstart.tar.gz

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Bille Jensen updated WICKET-847:
--------------------------------------

    Fix Version/s:     (was: 1.3.3)
                   1.3.4

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.4
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Bille Jensen updated WICKET-847:
--------------------------------------

    Fix Version/s:     (was: 1.3.2)
                   1.3.3

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.3
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Bille Jensen updated WICKET-847:
--------------------------------------

    Fix Version/s:     (was: 1.3.0-rc3)
                   1.3.1

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.1
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Erik van Oosten (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12628320#action_12628320 ] 

erikvanoosten edited comment on WICKET-847 at 9/4/08 5:03 AM:
----------------------------------------------------------------

I got bitten by this as well (with 1.4-m3).

The failing combination is: Tomcat and IE (6 or 7).

Firefox correctly interprets the "./" as "" so its okay to use Firefox + Tomcat.
Jetty converts "./" to "", so its okay to use any borwser on Jetty.

My workaround was to patch these two Wicket core files (I can confirm it works when redirecting to the home page):

BookmarkablePageRequestTarget:
-----------8<--------------------------
	public void respond(RequestCycle requestCycle)
	{
		if (pageClassRef != null && pageClassRef.get() != null)
		{
			if (requestCycle.isRedirect())
			{
				IRequestCycleProcessor processor = requestCycle.getProcessor();
				String redirectUrl = processor.getRequestCodingStrategy()
					.encode(requestCycle, this)
					.toString();
// START OF PATCH
                if (redirectUrl.startsWith("./")) {
                    redirectUrl = redirectUrl.substring(2);
                }
// END OF PATCH
                requestCycle.getResponse().redirect(redirectUrl);
			}
			else
			{
				// Let the page render itself
				getPage(requestCycle).renderPage();
			}
		}
	}
-----------8<--------------------------


RedirectRequestTarget:
-----------8<--------------------------
	public void respond(RequestCycle requestCycle)
	{
		Response response = requestCycle.getResponse();
		response.reset();
		if (redirectUrl.startsWith("/"))
		{
			RequestContext rc = RequestContext.get();
			if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded())
			{
				response.redirect(redirectUrl);
			}
			else
			{
                String location = RequestCycle.get()
                        .getRequest()
                        .getRelativePathPrefixToContextRoot() +
                        this.redirectUrl.substring(1);
// START OF PATCH
                if (location.startsWith("./")) {
                    location = location.substring(2);
                }
// END OF PATCH
                response.redirect(location);
			}
		}
		else if (redirectUrl.startsWith("http://") || redirectUrl.startsWith("https://"))
		{
			response.redirect(redirectUrl);
		}
		else
		{
			response.redirect(RequestCycle.get()
				.getRequest()
				.getRelativePathPrefixToWicketHandler() +
				redirectUrl);
		}
	}
-----------8<--------------------------


      was (Author: erikvanoosten):
    I got bitten by this as well (with 1.4-m3).

The failing combination is: Tomcat and IE (6 or 7).

Firefox correctly interprets the "./" as "" so its okay to use Firefox + Tomcat.
Jetty converts "./" to "", so its okay to use any borwser on Jetty.

My workaround was to patch these two Wicket core files (I can confirm it works):

BookmarkablePageRequestTarget:
-----------8<--------------------------
	public void respond(RequestCycle requestCycle)
	{
		if (pageClassRef != null && pageClassRef.get() != null)
		{
			if (requestCycle.isRedirect())
			{
				IRequestCycleProcessor processor = requestCycle.getProcessor();
				String redirectUrl = processor.getRequestCodingStrategy()
					.encode(requestCycle, this)
					.toString();
// START OF PATCH
                if (redirectUrl.startsWith("./")) {
                    redirectUrl = redirectUrl.substring(2);
                }
// END OF PATCH
                requestCycle.getResponse().redirect(redirectUrl);
			}
			else
			{
				// Let the page render itself
				getPage(requestCycle).renderPage();
			}
		}
	}
-----------8<--------------------------


RedirectRequestTarget:
-----------8<--------------------------
	public void respond(RequestCycle requestCycle)
	{
		Response response = requestCycle.getResponse();
		response.reset();
		if (redirectUrl.startsWith("/"))
		{
			RequestContext rc = RequestContext.get();
			if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded())
			{
				response.redirect(redirectUrl);
			}
			else
			{
                String location = RequestCycle.get()
                        .getRequest()
                        .getRelativePathPrefixToContextRoot() +
                        this.redirectUrl.substring(1);
// START OF PATCH
                if (location.startsWith("./")) {
                    location = location.substring(2);
                }
// END OF PATCH
                response.redirect(location);
			}
		}
		else if (redirectUrl.startsWith("http://") || redirectUrl.startsWith("https://"))
		{
			response.redirect(redirectUrl);
		}
		else
		{
			response.redirect(RequestCycle.get()
				.getRequest()
				.getRelativePathPrefixToWicketHandler() +
				redirectUrl);
		}
	}
-----------8<--------------------------

  
> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.5
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Frank Bille Jensen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Frank Bille Jensen updated WICKET-847:
--------------------------------------

    Fix Version/s:     (was: 1.3.1)
                   1.3.2

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.2
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Erik van Oosten (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12628320#action_12628320 ] 

Erik van Oosten commented on WICKET-847:
----------------------------------------

I got bitten by this as well (with 1.4-m3).

The failing combination is: Tomcat and IE (6 or 7).

Firefox correctly interprets the "./" as "" so its okay to use Firefox + Tomcat.
Jetty converts "./" to "", so its okay to use any borwser on Jetty.

My patch is:

In BookmarkablePageRequestTarget:
	public void respond(RequestCycle requestCycle)
	{
		if (pageClassRef != null && pageClassRef.get() != null)
		{
			if (requestCycle.isRedirect())
			{
				IRequestCycleProcessor processor = requestCycle.getProcessor();
				String redirectUrl = processor.getRequestCodingStrategy()
					.encode(requestCycle, this)
					.toString();
// START OF PATCH
                if (redirectUrl.startsWith("./")) {
                    redirectUrl = redirectUrl.substring(2);
                }
// END OF PATCH
                requestCycle.getResponse().redirect(redirectUrl);
			}
			else
			{
				// Let the page render itself
				getPage(requestCycle).renderPage();
			}
		}
	}


And in RedirectRequestTarget:
	public void respond(RequestCycle requestCycle)
	{
		Response response = requestCycle.getResponse();
		response.reset();
		if (redirectUrl.startsWith("/"))
		{
			RequestContext rc = RequestContext.get();
			if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded())
			{
				response.redirect(redirectUrl);
			}
			else
			{
                String location = RequestCycle.get()
                        .getRequest()
                        .getRelativePathPrefixToContextRoot() +
                        this.redirectUrl.substring(1);
// START OF PATCH
                if (location.startsWith("./")) {
                    location = location.substring(2);
                }
// END OF PATCH
                response.redirect(location);
			}
		}
		else if (redirectUrl.startsWith("http://") || redirectUrl.startsWith("https://"))
		{
			response.redirect(redirectUrl);
		}
		else
		{
			response.redirect(RequestCycle.get()
				.getRequest()
				.getRelativePathPrefixToWicketHandler() +
				redirectUrl);
		}
	}


> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.5
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Erik van Oosten (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12628320#action_12628320 ] 

erikvanoosten edited comment on WICKET-847 at 9/4/08 5:03 AM:
----------------------------------------------------------------

I got bitten by this as well (with 1.4-m3).

The failing combination is: Tomcat and IE (6 or 7).

Firefox correctly interprets the "./" as "" so its okay to use Firefox + Tomcat.
Jetty converts "./" to "", so its okay to use any borwser on Jetty.

My workaround was to patch these two Wicket core files (I can confirm it works):

BookmarkablePageRequestTarget:
-----------8<--------------------------
	public void respond(RequestCycle requestCycle)
	{
		if (pageClassRef != null && pageClassRef.get() != null)
		{
			if (requestCycle.isRedirect())
			{
				IRequestCycleProcessor processor = requestCycle.getProcessor();
				String redirectUrl = processor.getRequestCodingStrategy()
					.encode(requestCycle, this)
					.toString();
// START OF PATCH
                if (redirectUrl.startsWith("./")) {
                    redirectUrl = redirectUrl.substring(2);
                }
// END OF PATCH
                requestCycle.getResponse().redirect(redirectUrl);
			}
			else
			{
				// Let the page render itself
				getPage(requestCycle).renderPage();
			}
		}
	}
-----------8<--------------------------


RedirectRequestTarget:
-----------8<--------------------------
	public void respond(RequestCycle requestCycle)
	{
		Response response = requestCycle.getResponse();
		response.reset();
		if (redirectUrl.startsWith("/"))
		{
			RequestContext rc = RequestContext.get();
			if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded())
			{
				response.redirect(redirectUrl);
			}
			else
			{
                String location = RequestCycle.get()
                        .getRequest()
                        .getRelativePathPrefixToContextRoot() +
                        this.redirectUrl.substring(1);
// START OF PATCH
                if (location.startsWith("./")) {
                    location = location.substring(2);
                }
// END OF PATCH
                response.redirect(location);
			}
		}
		else if (redirectUrl.startsWith("http://") || redirectUrl.startsWith("https://"))
		{
			response.redirect(redirectUrl);
		}
		else
		{
			response.redirect(RequestCycle.get()
				.getRequest()
				.getRelativePathPrefixToWicketHandler() +
				redirectUrl);
		}
	}
-----------8<--------------------------


      was (Author: erikvanoosten):
    I got bitten by this as well (with 1.4-m3).

The failing combination is: Tomcat and IE (6 or 7).

Firefox correctly interprets the "./" as "" so its okay to use Firefox + Tomcat.
Jetty converts "./" to "", so its okay to use any borwser on Jetty.

My patch is:

In BookmarkablePageRequestTarget:
	public void respond(RequestCycle requestCycle)
	{
		if (pageClassRef != null && pageClassRef.get() != null)
		{
			if (requestCycle.isRedirect())
			{
				IRequestCycleProcessor processor = requestCycle.getProcessor();
				String redirectUrl = processor.getRequestCodingStrategy()
					.encode(requestCycle, this)
					.toString();
// START OF PATCH
                if (redirectUrl.startsWith("./")) {
                    redirectUrl = redirectUrl.substring(2);
                }
// END OF PATCH
                requestCycle.getResponse().redirect(redirectUrl);
			}
			else
			{
				// Let the page render itself
				getPage(requestCycle).renderPage();
			}
		}
	}


And in RedirectRequestTarget:
	public void respond(RequestCycle requestCycle)
	{
		Response response = requestCycle.getResponse();
		response.reset();
		if (redirectUrl.startsWith("/"))
		{
			RequestContext rc = RequestContext.get();
			if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded())
			{
				response.redirect(redirectUrl);
			}
			else
			{
                String location = RequestCycle.get()
                        .getRequest()
                        .getRelativePathPrefixToContextRoot() +
                        this.redirectUrl.substring(1);
// START OF PATCH
                if (location.startsWith("./")) {
                    location = location.substring(2);
                }
// END OF PATCH
                response.redirect(location);
			}
		}
		else if (redirectUrl.startsWith("http://") || redirectUrl.startsWith("https://"))
		{
			response.redirect(redirectUrl);
		}
		else
		{
			response.redirect(RequestCycle.get()
				.getRequest()
				.getRelativePathPrefixToWicketHandler() +
				redirectUrl);
		}
	}

  
> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.5
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12520217 ] 

Alastair Maw commented on WICKET-847:
-------------------------------------

A workaround for this is probably to mount your homepage in your application init() - mountBookmarkablePage(MyHomePage.class, "/home");
Will look into this, though.

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-rc1
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-847:
---------------------------------

    Fix Version/s: 1.4-M3
         Assignee: Martijn Dashorst  (was: Igor Vaynberg)

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Martijn Dashorst
>             Fix For: 1.3.5, 1.4-M3
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Andrew Klochkov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522187 ] 

Andrew Klochkov commented on WICKET-847:
----------------------------------------

The evil code is in the WebRequestCodingStrategy class:

			// We need to special-case links to the home page if we're at the
			// same level.
			if (result.length() == 0)
			{
				result = "./";
			}

A workaround is to override newWebResponse in Application subclass to prevent such redirects

<pre>
        protected WebResponse newWebResponse(HttpServletResponse servletResponse)
	{
		return new BufferedWebResponse(servletResponse) {

			public CharSequence encodeURL(CharSequence url)
			{
				return "./".equals(url) ? "" : super.encodeURL(url);
			}
			
		};
	}
</pre>

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-rc1
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reopened WICKET-847:
----------------------------------


> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Martijn Dashorst
>             Fix For: 1.3.5, 1.4-M3
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-847) setResponsePage redirects to wrong url

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw reassigned WICKET-847:
-----------------------------------

    Assignee: Alastair Maw

> setResponsePage redirects to wrong url
> --------------------------------------
>
>                 Key: WICKET-847
>                 URL: https://issues.apache.org/jira/browse/WICKET-847
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Andrew Klochkov
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-rc1
>
>         Attachments: wicket-quickstart.tar.gz
>
>
> When I do setResponsePage(MyHomePage.class) IE tries to show me "my.site.com/./" url and gets 404 response. 
> Firefox just shows "my.site.com" without any troubles. I'm using wicket 1.3-beta2 and WicketFilter mapped to /*. 
> It's being reproduced under tomcat only, jetty works fine. My tomcat version is 5.5.17. 
> Quickstart project which reproduces the bug is attached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.