Sampath,
 I need to start a JSP session with a given Id,  like "http://localhost/home.jsp?session=123456789", but not  like "http://localhost/home.jsp;jsessionid=123456789?<query_string>".
 If you know PHP, see below code:
 <?php
 session_id($_GET['session']);
 session_start();
 // rest of the code
 ?>
 I want to do the same using JSP too. I need this  because the client is not a browser. It just sends send HTTP requests and  expects a reply. The client includes "?session=<session_id>" to it's request, where  session_id is generated in the very first HTTP  request. It's similar to a web browser with cookies disabled.
 But the client cannot send a request like "http://localhost/home.jsp;jsessionid=123456789?<query_string>".
 When I tried "session.setId(request.getParameter("session"));" I got  an exception, "The method setId(String) is undefined  for the type HttpSession"
 Looking forward to a favorable  reply.
 Regards.
 Amil.
 
1 comment:
According my knowledge we can't give a specific session ID to the http session. It is an auto generated value by the web server. And also there is no setId method in HttpSession interface because of this. But you can join the existing session since you have the session id in your request.
Post a Comment