I�m having a problem about a session tracking, I�m using in the doGet method a code like this: HttpSession session = request.getSession(true); and than I use this session.putValue("ValoresDiretorioP",ValoresDiretorioP); and finally I use session.getValue("ValoresDiretorioP"); to recover the value, everything goes well in most computers but in some when there is a new call to the servlet a new session is created, and i loose all the information I already have. I�ve enabled the cookies in all machines but I�m still having this problem. I�ve talked whith a friend, and he told me tha he had the same problem when he tried to load a image from a diferent server(the session changed), in my program I have to open a socket to receive information from a C server every time the servlet have requests from the user,I think that�s the problem, the server creates a new session to comunicate with the C server, but the big mass is that in most machines it work and I�m getting crazy with it. So if in this case there�s no solution, I�d like to know how to recover the values from the old session when a new one is created. Thank you all in advance.
"in my program I have to open a socket to receive information from a C server every time the servlet have requests from the user,I think that�s the problem, the server creates a new session to comunicate with the C server" Certainly not, HttpSessions are only created for HTTP request/response cycles. Is it possible that the session is timing out? A timeout of 30 minutes seems to be common. Bill
Marcos, To make a dirty check, most probably there will be only one place where you woulde actually create a new session right? In my case it is LoginServlet which will validate the user and creates a new session with request.getSession(true) statement. In all other servlets, what I do is just use request.getSession(false) to setAttribute and getAttribute related works. If I found the session is null for request.getSession(false), then I know something is wrong, and redirect them to Login page again. While testing, I had this experience. If I logged in first and went for lunch/coffee , when I come back and continue using the appln, I been redirected to Login Page again. I took it as session timout, since I didn't use the appln for long time. Which servlet engine are you usiing. There is a way to set the session timeout in ...WEB-INF/web.xml file. Another way is to use session.setMaxInactiveIntervel(time_in_secs). (Please refer the API). This API overrides the web.xml value. Try to include this session.setMaxInactiveIntervel API as soon as you create a fresh session. regds maha anna regds maha anna
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com