I set a servlet context attribute, which is an object of Serializable class. Does it persist after application server restart as session attributes do?
I set a servlet context attribute, which is an object of Serializable class. Does
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Attributes in servlet contexts are not automatically persisted. If you want to persist them you will need to do it yourself.
I don’t think persistence of servlet context attributes would be a good idea. There is a non-zero chance that the servlet container will terminate abruptly without giving your webapp a chance to persist its attributes. Your webapp would need to deal with this possibility on restart.