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

Session-Rewrite-Error when using absolute redirects

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:
      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)
      ...

        Activity

        Hide
        medgar Malcolm Edgar added a comment -

        Checked into CVS, will be available in release 0.18

        Show
        medgar Malcolm Edgar added a comment - Checked into CVS, will be available in release 0.18

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development