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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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.
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.