URLConnection & jsessionid to keep httpSession
Hi,
I would like to simulate a request from my browser client, through the URLConnection class.
My problem is that my Tomcat creates a new HTTPSession each time I make the urlConnection.getInputStream().
I would like Tomcat to use the browser's session, which I set like that :
urlconnection.setRequestProperty("Cookie","jsessionid=" + jsessionid);
urlconnection.setUseCaches(false);
urlconnection.connect();
urlconnection.getInputStream();
I found some links about this problem, but the following one is not found anymore :
http://forum.java.sun.com/thread.jspa?forumID=33&threadID=67175
Others links :
http://forum.java.sun.com/thread.jspa?forumID=33&threadID=632438
http://forum.java.sun.com/thread.jspa?forumID=33&threadID=599361
This is what happens :
1/ browser makes a request to the server
2/ the server answers the request
2.1/ In parallel, i make my urlConnection, with the jsessionid
2.2/ The server creates a new HttpSession :-(
The problem is that, those urlConnection create as many HttpSession on the server as the number of time they are called
Any help ? :p

