How to check if sessionId is valid in servlet (java)

I support map sessionid (s) and HttpSession objects in my web application. I use HttpSessionListener to populate or delete a session from the map. When my web server crashes and goes down and returns, I need a way to check if the provided sessionid is valid or not. Obviously, when the application returns to the network, the card is empty, so all session identifiers are invalid, but I just want some way to check the incoming sessionid, if possible at all ..

thank

+2
source share
3 answers

- . , . , , , .

+3

- -. , , / . , .

+1

Why do you maintain sessions yourself? The servlet container should do this for you. I did not see your code, maybe you have every reason to do what you are doing, but it seems to me that you simply do not understand the servlet API and are trying to reimplement it.

In addition, you may be interested: Tomcat has a function in which it is saved, and this means that the session state is saved when the server restarts. (Disable this when updating the application, as there may be discrepancies between different versions of the classes.)

+1
source

All Articles