Package com.helger.servlet.session
Class SessionHelper
- java.lang.Object
-
- com.helger.servlet.session.SessionHelper
-
@Immutable public final class SessionHelper extends Object
HTTP session utilities.- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Enumeration<String>getAllAttributes(jakarta.servlet.http.HttpSession aSession)Get all attribute names present in the specified session.static com.helger.commons.state.EChangesafeInvalidateSession(jakarta.servlet.http.HttpSession aSession)Invalidate the session if the session is still active.static jakarta.servlet.http.HttpSessionsafeRenewSession(jakarta.servlet.http.HttpServletRequest aHttpRequest)Invalidate the session of the specified request (if any) and create a new session.
-
-
-
Method Detail
-
safeInvalidateSession
@Nonnull public static com.helger.commons.state.EChange safeInvalidateSession(@Nullable jakarta.servlet.http.HttpSession aSession)
Invalidate the session if the session is still active.- Parameters:
aSession- The session to be invalidated. May benull.- Returns:
EChange.CHANGEDif the session was invalidated,EChange.UNCHANGEDotherwise.
-
getAllAttributes
@Nonnull public static Enumeration<String> getAllAttributes(@Nonnull jakarta.servlet.http.HttpSession aSession)
Get all attribute names present in the specified session.- Parameters:
aSession- The session to use. May not benull.- Returns:
- Never
null.
-
safeRenewSession
@Nonnull public static jakarta.servlet.http.HttpSession safeRenewSession(@Nonnull jakarta.servlet.http.HttpServletRequest aHttpRequest)
Invalidate the session of the specified request (if any) and create a new session.- Parameters:
aHttpRequest- The HTTP request to use. May not benull.- Returns:
- The new
HttpSessionto use. Nevernull.
-
-