Package org.apache.webbeans.web.context
Class WebContextsService
- java.lang.Object
-
- org.apache.webbeans.context.AbstractContextsService
-
- org.apache.webbeans.web.context.WebContextsService
-
- All Implemented Interfaces:
org.apache.webbeans.spi.ContextsService
public class WebContextsService extends org.apache.webbeans.context.AbstractContextsServiceWeb containerContextsServiceimplementation.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.webbeans.context.ApplicationContextapplicationContextA single applicationContextprotected ThreadLocal<org.apache.webbeans.context.ConversationContext>conversationContextsCurrent conversation contextprotected org.apache.webbeans.conversation.ConversationManagerconversationManagerConversation context managerprotected org.apache.webbeans.context.DependentContextdependentContextCurrent dependent contextprotected BooleaneagerSessionInitialisationprotected PatterneagerSessionPatternprotected ThreadLocal<ServletRequestContext>requestContextsCurrent request contextprotected ThreadLocal<org.apache.webbeans.context.SessionContext>sessionContextsCurrent session contextprotected org.apache.webbeans.context.SingletonContextsingletonContext
-
Constructor Summary
Constructors Constructor Description WebContextsService(org.apache.webbeans.config.WebBeansContext webBeansContext)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigureEagerSessionInitialisation(org.apache.webbeans.config.WebBeansContext webBeansContext)voiddestroy(Object destroyObject)protected voiddestroyApplicationContext(Object endObject)Destroys the application context and all of its components at the end of the application.protected voiddestroyConversationContext()Destroy conversation context.protected voiddestroyRequestContext(Object endObject)Destroys the request context and all of its components.protected voiddestroySessionContext(Object endObject)Destroys the session context and all of its components at the end of the session.protected voiddestroySingletonContext(Object endObject)Destroy singleton context.voidendContext(Class<? extends Annotation> scopeType, Object endParameters)org.apache.webbeans.context.ConversationContextgetConversationContext(boolean create, boolean ignoreProblems)Get current conversation ctx.jakarta.enterprise.context.spi.ContextgetCurrentContext(Class<? extends Annotation> scopeType)jakarta.enterprise.context.spi.ContextgetCurrentContext(Class<? extends Annotation> scopeType, boolean createIfNotExists)ServletRequestContextgetRequestContext(boolean create)Get current request ctx.org.apache.webbeans.context.SessionContextgetSessionContext(boolean forceCreate)Get current session ctx or lazily create one.voidinit(Object initializeObject)protected voidinitApplicationContext(Object startupObject)Creates the application context at the application startupprotected voidinitConversationContext(Object startObject)Initialize conversation context.protected voidinitRequestContext(Object startupObject)Initialize requext context with the given request object.protected voidinitSessionContext(Object startupObject)Creates the session context at the session start.protected voidinitSingletonContext(Object startupObject)Initialize singleton context.voidremoveThreadLocals()Removes the ThreadLocals from the ThreadMap to prevent memory leaks.protected booleansessionIsExpiring(jakarta.servlet.http.HttpSession session)protected booleanshouldEagerlyInitializeSession(jakarta.servlet.http.HttpServletRequest request)voidstartContext(Class<? extends Annotation> scopeType, Object startParameter)
-
-
-
Field Detail
-
applicationContext
protected org.apache.webbeans.context.ApplicationContext applicationContext
A single applicationContext
-
singletonContext
protected org.apache.webbeans.context.SingletonContext singletonContext
-
requestContexts
protected ThreadLocal<ServletRequestContext> requestContexts
Current request context
-
sessionContexts
protected ThreadLocal<org.apache.webbeans.context.SessionContext> sessionContexts
Current session context
-
conversationContexts
protected ThreadLocal<org.apache.webbeans.context.ConversationContext> conversationContexts
Current conversation context
-
dependentContext
protected org.apache.webbeans.context.DependentContext dependentContext
Current dependent context
-
conversationManager
protected final org.apache.webbeans.conversation.ConversationManager conversationManager
Conversation context manager
-
eagerSessionInitialisation
protected Boolean eagerSessionInitialisation
-
eagerSessionPattern
protected Pattern eagerSessionPattern
-
-
Method Detail
-
configureEagerSessionInitialisation
protected void configureEagerSessionInitialisation(org.apache.webbeans.config.WebBeansContext webBeansContext)
-
removeThreadLocals
public void removeThreadLocals()
Removes the ThreadLocals from the ThreadMap to prevent memory leaks.- Specified by:
removeThreadLocalsin interfaceorg.apache.webbeans.spi.ContextsService- Overrides:
removeThreadLocalsin classorg.apache.webbeans.context.AbstractContextsService
-
init
public void init(Object initializeObject)
- Specified by:
initin interfaceorg.apache.webbeans.spi.ContextsService- Overrides:
initin classorg.apache.webbeans.context.AbstractContextsService
-
destroy
public void destroy(Object destroyObject)
- Specified by:
destroyin interfaceorg.apache.webbeans.spi.ContextsService- Overrides:
destroyin classorg.apache.webbeans.context.AbstractContextsService
-
endContext
public void endContext(Class<? extends Annotation> scopeType, Object endParameters)
- Specified by:
endContextin interfaceorg.apache.webbeans.spi.ContextsService- Overrides:
endContextin classorg.apache.webbeans.context.AbstractContextsService
-
getCurrentContext
public jakarta.enterprise.context.spi.Context getCurrentContext(Class<? extends Annotation> scopeType, boolean createIfNotExists)
- Specified by:
getCurrentContextin interfaceorg.apache.webbeans.spi.ContextsService- Overrides:
getCurrentContextin classorg.apache.webbeans.context.AbstractContextsService
-
getCurrentContext
public jakarta.enterprise.context.spi.Context getCurrentContext(Class<? extends Annotation> scopeType)
- Specified by:
getCurrentContextin interfaceorg.apache.webbeans.spi.ContextsService- Overrides:
getCurrentContextin classorg.apache.webbeans.context.AbstractContextsService
-
startContext
public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws jakarta.enterprise.context.ContextException
- Specified by:
startContextin interfaceorg.apache.webbeans.spi.ContextsService- Overrides:
startContextin classorg.apache.webbeans.context.AbstractContextsService- Throws:
jakarta.enterprise.context.ContextException
-
initRequestContext
protected void initRequestContext(Object startupObject)
Initialize requext context with the given request object.- Parameters:
startupObject- http servlet request event or system specific payload
-
shouldEagerlyInitializeSession
protected boolean shouldEagerlyInitializeSession(jakarta.servlet.http.HttpServletRequest request)
-
destroyRequestContext
protected void destroyRequestContext(Object endObject)
Destroys the request context and all of its components.- Parameters:
endObject- http servlet request object or other payload
-
initSessionContext
protected void initSessionContext(Object startupObject)
Creates the session context at the session start.- Parameters:
startupObject- HttpSession object
-
destroySessionContext
protected void destroySessionContext(Object endObject)
Destroys the session context and all of its components at the end of the session.- Parameters:
endObject- http session object. Can benullor different object for non-http SessionContexts. Such a context only lives for one thread.
-
sessionIsExpiring
protected boolean sessionIsExpiring(jakarta.servlet.http.HttpSession session)
- Returns:
trueif the sessino is currently expiring or has already expired
-
initApplicationContext
protected void initApplicationContext(Object startupObject)
Creates the application context at the application startup- Parameters:
startupObject- servlet context object or other startup
-
destroyApplicationContext
protected void destroyApplicationContext(Object endObject)
Destroys the application context and all of its components at the end of the application.- Parameters:
endObject- servlet context object or other payload
-
initSingletonContext
protected void initSingletonContext(Object startupObject)
Initialize singleton context.- Parameters:
startupObject- servlet context
-
destroySingletonContext
protected void destroySingletonContext(Object endObject)
Destroy singleton context.- Parameters:
endObject- servlet context or other payload
-
initConversationContext
protected void initConversationContext(Object startObject)
Initialize conversation context.- Parameters:
startObject- either a ServletRequest or a ConversationContext
-
destroyConversationContext
protected void destroyConversationContext()
Destroy conversation context.
-
getRequestContext
public ServletRequestContext getRequestContext(boolean create)
Get current request ctx.- Returns:
- request context
-
getSessionContext
public org.apache.webbeans.context.SessionContext getSessionContext(boolean forceCreate)
Get current session ctx or lazily create one.- Parameters:
forceCreate- iftruewe will force creating a session if not yet exists. iffalsewe will only create a SessionContext if a HttpSession already exists- Returns:
- session context
-
getConversationContext
public org.apache.webbeans.context.ConversationContext getConversationContext(boolean create, boolean ignoreProblems)Get current conversation ctx.- Returns:
- conversation context
-
-