Does SessionStatus object.setComplete() clears all the session attributes or just work for the controller in which it is used?

拟墨画扇 提交于 2019-12-22 04:06:45

问题


I am not clear about this if I use SessionStatus object.setComplete() in a Controller, does it clears all the session data of the Webapp or just clears the session data saved by a particular controller in which @SessionAttributes is used?


回答1:


SessionStatus#setComplete() JavaDoc is pretty clear about the method's purpose:

/**
 * Mark the current handler's session processing as complete, allowing for
 * cleanup of session attributes.
 */

This clears the current handler's session attributes registered via @SessionAttribute. This is completely different from servlet's HttpSession#invalidate():

/**
 * Invalidates this session then unbinds any objects bound to it. 
 */

This one actually destroys the user session completely.



来源:https://stackoverflow.com/questions/17038709/does-sessionstatus-object-setcomplete-clears-all-the-session-attributes-or-jus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!