Struts Menu
  1. Struts Menu
  2. SM-78

Make appending jsessionid configurable so it's only added when user wants it to be added

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.4.2
    • Fix Version/s: 2.4.3
    • Component/s: Menu Core
    • Labels:
      None

      Description

      Based on discussions at http://www.nabble.com/Identifier-JSESSIONID-exposed-on-all-my-struts-menu-webapps-tf3414711.html.

      Related to SM-64.

      Will likely implement as a property in the plugin and a context-param for the listener.

        Activity

        Hide
        Matt Raible added a comment -

        Since the stripping of jsessionid from URLs is likely to be something you want for more than just menu links, I'm going to recommend users use the UrlRewriteFilter (now BSD licensed) to implement this feature.

        From http://tuckey.org/urlrewrite/manual/3.0/guide.html (search for jsessionid):

        <outbound-rule>
        <name>Strip URL Session ID's</name>
        <note>
        Strip ;jsession=XXX from urls passed through
        response.encodeURL().
        The characters ? and # are the only things we can use to
        find out where the jsessionid ends.
        The expression in 'from' below contains three capture
        groups, the last two being optional.
        1, everything before ;jesessionid
        2, everything after ;jesessionid=XXX starting with a ?
        (to get the query string) up to #
        3, everything ;jesessionid=XXX and optionally ?XXX
        starting with a # (to get the target)
        eg,
        from index.jsp;jsessionid=sss?qqq to index.jsp?qqq
        from index.jsp;jsessionid=sss?qqq#ttt to index.jsp?qqq#ttt
        from index.jsp;jsessionid=asdasdasdsadsadasd#dfds -
        index.jsp#dfds
        from u.jsp;jsessionid=wert.hg - u.jsp
        from /;jsessionid=tyu - /
        </note>
        <condition name="user-agent">googlebot</condition>
        <from>^(.?)(?:\;jsessionid=[^\?#])?(?[^#])?(#.)?$</from>
        <to>$1$2$3</to>
        </outbound-rule>

        Show
        Matt Raible added a comment - Since the stripping of jsessionid from URLs is likely to be something you want for more than just menu links, I'm going to recommend users use the UrlRewriteFilter (now BSD licensed) to implement this feature. From http://tuckey.org/urlrewrite/manual/3.0/guide.html (search for jsessionid): <outbound-rule> <name>Strip URL Session ID's</name> <note> Strip ;jsession=XXX from urls passed through response.encodeURL(). The characters ? and # are the only things we can use to find out where the jsessionid ends. The expression in 'from' below contains three capture groups, the last two being optional. 1, everything before ;jesessionid 2, everything after ;jesessionid=XXX starting with a ? (to get the query string) up to # 3, everything ;jesessionid=XXX and optionally ?XXX starting with a # (to get the target) eg, from index.jsp;jsessionid=sss?qqq to index.jsp?qqq from index.jsp;jsessionid=sss?qqq#ttt to index.jsp?qqq#ttt from index.jsp;jsessionid=asdasdasdsadsadasd#dfds - index.jsp#dfds from u.jsp;jsessionid=wert.hg - u.jsp from /;jsessionid=tyu - / </note> <condition name="user-agent">googlebot</condition> <from>^(. ?)(?:\;jsessionid= [^\?#] )?(? [^#] )?(#. )?$</from> <to>$1$2$3</to> </outbound-rule>

          People

          • Assignee:
            Matt Raible
            Reporter:
            Matt Raible
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development