Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Click-0.17
Description
If you use absolute redirects (turned off cookies), Click fails to rewrite the url:
Example (application):
public boolean onOkClicked()
{ setRedirect("/overview.htm"); }
ClickServlet.java (448ff) handles this case and reads:
package net.sf.click;
...
if (page.getRedirect() != null) {
String url = response.encodeRedirectURL(page.getRedirect());
if (url.charAt(0) == '/')
{ url = request.getContextPath() + url; }...
This fails because the encodeRedirectURL gets an absolute path ("/overview.htm") with page.getRedirect and recognizes this as a different web-application in the container (and therefore does not rewrite the url).
The "correct" code should look something like this:
if (page.getRedirect() != null) {
String url = page.getRedirect();
if (url.charAt(0) == '/') { url = request.getContextPath() + url; }
url = response.encodeRedirectURL(url)
...