Uploaded image for project: 'Click'
  1. Click
  2. CLK-51

Session-Rewrite-Error when using absolute redirects

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • core
    • 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)
      ...

      Attachments

        Activity

          People

            medgar Malcolm Edgar
            mjablonski Maik Jablonski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: