Interface HttpSessionContext
- All Superinterfaces:
jakarta.enterprise.context.spi.AlterableContext,BoundContext<jakarta.servlet.http.HttpServletRequest>,jakarta.enterprise.context.spi.Context,ManagedContext,SessionContext,WeldAlterableContext
A session context which can be bound to the HttpServletRequest. The context is automatically attached to the map on
activation, and detached when invalidate() is called.
This context is not thread safe, and provides no thread safety for the underlying map.
- Author:
- Pete Muir
-
Method Summary
Modifier and TypeMethodDescriptionbooleandestroy(jakarta.servlet.http.HttpSession session) Destroy the session and all conversations stored in the session.voidMark the Session Context for destruction; the Session Context will be detached from the underling Http Session, and instances marked for destruction when the Http Request is destroyed.booleanisValid()Returns false if the session has been invalidated (usinginvalidate()).Methods inherited from interface jakarta.enterprise.context.spi.AlterableContext
destroyMethods inherited from interface org.jboss.weld.context.BoundContext
associate, dissociateMethods inherited from interface jakarta.enterprise.context.spi.Context
get, get, getScope, isActiveMethods inherited from interface org.jboss.weld.context.ManagedContext
activate, deactivateMethods inherited from interface org.jboss.weld.context.WeldAlterableContext
clearAndSet, getAllContextualInstances
-
Method Details
-
invalidate
void invalidate()Mark the Session Context for destruction; the Session Context will be detached from the underling Http Session, and instances marked for destruction when the Http Request is destroyed.
- Specified by:
invalidatein interfaceManagedContext
-
isValid
boolean isValid()Returns false if the session has been invalidated (using
invalidate()). Returns true otherwise.- Returns:
- true if
invalidate()has been called on this context
-
destroy
boolean destroy(jakarta.servlet.http.HttpSession session) Destroy the session and all conversations stored in the session.
If the context is not currently associated with a
HttpServletRequest, then the context will be associated with the specifiedHttpSession(for this thread), activated, destroyed, and then deactivated.If the context is already associated with a
HttpServletRequestthen this call will detach the context from the underlying Http Session, and mark the context for destruction when the request is destroyed.- Parameters:
session- theHttpSessionin which to store the bean instances- Returns:
- true if the context was destroyed immediately
-