Tapestry
  1. Tapestry
  2. TAPESTRY-1833

XTile does not work with cookies turned off

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.3
    • Fix Version/s: 4.1.5
    • Component/s: Contrib
    • Labels:
      None

      Description

      The URLs created by XTile do not contain the jsession-id when used with cookies turned off. This is because the link is created with "stateful" set to false (see XTileService.java, line 76). Turning this to true fixes the problem and the URLs are generated including the jsession-id.

      Here's the patch:

      Index: src/java/org/apache/tapestry/contrib/ajax/XTileService.java
      ===================================================================
      — src/java/org/apache/tapestry/contrib/ajax/XTileService.java (revision 585120)
      +++ src/java/org/apache/tapestry/contrib/ajax/XTileService.java (working copy)
      @@ -73,7 +73,7 @@
      parameters.put(ServiceConstants.PAGE, component.getPage().getPageName());
      parameters.put(ServiceConstants.COMPONENT, component.getIdPath());

      • return _linkFactory.constructLink(this, false, parameters, false);
        + return _linkFactory.constructLink(this, false, parameters, true);
        }

      public void service(IRequestCycle cycle) throws IOException

        Activity

        Hide
        Andreas Andreou added a comment -

        What do you mean by "XTile does not work" ?
        Isn't the listener called? or, you just can't get access to session data?

        Show
        Andreas Andreou added a comment - What do you mean by "XTile does not work" ? Isn't the listener called? or, you just can't get access to session data?
        Hide
        Manfred Hantschel added a comment -

        I cant get access to the session data. Usually the session cookie is automatically sent along with the xhr. But our application has cookies turned off, which means that the url has to contain the jsessionid. The jsessionid is added to the url by calling the ServletResponse.encodeURL method. But this method is not called, because the last parameter in the constructLink method is set to false.

        As a result: cookies turned on, i have access to the session data. cookies turned off, i dont have access to the session data. this even occures if the webapp has cookies turn on, but the browser does not support cookies.

        i have tested the above patch, and it works well.

        Show
        Manfred Hantschel added a comment - I cant get access to the session data. Usually the session cookie is automatically sent along with the xhr. But our application has cookies turned off, which means that the url has to contain the jsessionid. The jsessionid is added to the url by calling the ServletResponse.encodeURL method. But this method is not called, because the last parameter in the constructLink method is set to false. As a result: cookies turned on, i have access to the session data. cookies turned off, i dont have access to the session data. this even occures if the webapp has cookies turn on, but the browser does not support cookies. i have tested the above patch, and it works well.
        Hide
        Andreas Andreou added a comment -

        I'd seen the issue and know the patch works - it couldn't be any simpler

        Just wanted to make sure you weren't describing something else

        Show
        Andreas Andreou added a comment - I'd seen the issue and know the patch works - it couldn't be any simpler Just wanted to make sure you weren't describing something else
        Hide
        Manfred Hantschel added a comment - - edited

        i'm happy bout that, thanks

        Manfred

        Show
        Manfred Hantschel added a comment - - edited i'm happy bout that, thanks Manfred

          People

          • Assignee:
            Andreas Andreou
            Reporter:
            Manfred Hantschel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development