Menu

session tracking/url rewriting

2003-03-12
2003-03-13
  • Jules Gosnell

    Jules Gosnell - 2003-03-12

    I've just started playing with HttpUnit today, and am using it to write a test harness around a filter that I use to prevent new sessions being accepted by a webapp.

    The filter needs to work not just for Cookie-based session tracking, but url-rewriting based tracking as well (e.g. http:/host/webapp;jsessionid=abcd).

    I cannot figure out how to retrieve the ';jsessionid=abcd' from the WebResponse, so that I can pass it to the subsequent WebRequest.

    I have grepped through the entire distributable and found no mention of the string jsessionid or JSESSIONID (the key used to identify the session Cookie).

    Any pointers would be greatly appreciated....

    Jules

     
    • Mattias Jiderhamn

      I guess you would pick out any link of form from the response and do webLink.getURLString() or webForm.getAction() and then parse the jsession ID from that String.

       
    • Russell Gold

      Russell Gold - 2003-03-13

      You will have to disable cookies :

      HttpUnitOptions.setAcceptCookies( false )

      and then parse the returned links to get the jessionid from it. You should also be able to retrieve the JSESSIONID cookie from the web conversation:

      wc.getCookiedValue( "JSESSIONID" ).

      You see no documentation on these names because HttpUnit is not J2EE-specific.

       

Log in to post a comment.

Auth0 Logo