Does Sessionstatus Object. setComplete() Clears All the Session Attributes or Just Work for the Controller in Which It Is Used?

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

1 Answer

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest