Package pl.morgwai.base.servlet.scopes
Class ContainerCallContext
- java.lang.Object
-
- pl.morgwai.base.guice.scopes.InjectionContext
-
- pl.morgwai.base.guice.scopes.TrackableContext<ContainerCallContext>
-
- pl.morgwai.base.servlet.scopes.ContainerCallContext
-
- Direct Known Subclasses:
ServletRequestContext
,WebsocketEventContext
public abstract class ContainerCallContext extends TrackableContext<ContainerCallContext>
Context of either anHttpServletRequest
or awebsocket event
. Each instance corresponds to a single container-initiated call to either one of servlet'sdoXXX(...)
methods or to a websocket endpoint life-cycle method.Suitable for storing short-living objects, such as
EntityManager
s or DB transactions.Having a common super class for
ServletRequestContext
andWebsocketEventContext
allows instances from a single container-call scoped binding to be obtained both in servlets and endpoints without a need for 2 separate bindings with different@Named
annotation value.- See Also:
corresponding Scope
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ContainerCallContext(ContextTracker<ContainerCallContext> tracker)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract HttpSession
getHttpSession()
Returns theHttpSession
this request belongs to.HttpSessionContext
getHttpSessionContext()
Returns context ofthe session this request belongs to
.-
Methods inherited from class pl.morgwai.base.guice.scopes.TrackableContext
executeWithinSelf, executeWithinSelf
-
Methods inherited from class pl.morgwai.base.guice.scopes.InjectionContext
provideIfAbsent, removeScopedObject
-
-
-
-
Constructor Detail
-
ContainerCallContext
protected ContainerCallContext(ContextTracker<ContainerCallContext> tracker)
-
-
Method Detail
-
getHttpSession
public abstract HttpSession getHttpSession()
Returns theHttpSession
this request belongs to.
-
getHttpSessionContext
public HttpSessionContext getHttpSessionContext()
Returns context ofthe session this request belongs to
.
-
-