Class WebContextsService

  • All Implemented Interfaces:
    org.apache.webbeans.spi.ContextsService

    public class WebContextsService
    extends org.apache.webbeans.context.AbstractContextsService
    Web container ContextsService implementation.
    • Field Detail

      • applicationContext

        protected org.apache.webbeans.context.ApplicationContext applicationContext
        A single applicationContext
      • singletonContext

        protected org.apache.webbeans.context.SingletonContext singletonContext
      • 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
    • Constructor Detail

      • WebContextsService

        public WebContextsService​(org.apache.webbeans.config.WebBeansContext webBeansContext)
        Creates a new instance.
    • 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:
        removeThreadLocals in interface org.apache.webbeans.spi.ContextsService
        Overrides:
        removeThreadLocals in class org.apache.webbeans.context.AbstractContextsService
      • init

        public void init​(Object initializeObject)
        Specified by:
        init in interface org.apache.webbeans.spi.ContextsService
        Overrides:
        init in class org.apache.webbeans.context.AbstractContextsService
      • destroy

        public void destroy​(Object destroyObject)
        Specified by:
        destroy in interface org.apache.webbeans.spi.ContextsService
        Overrides:
        destroy in class org.apache.webbeans.context.AbstractContextsService
      • endContext

        public void endContext​(Class<? extends Annotation> scopeType,
                               Object endParameters)
        Specified by:
        endContext in interface org.apache.webbeans.spi.ContextsService
        Overrides:
        endContext in class org.apache.webbeans.context.AbstractContextsService
      • getCurrentContext

        public jakarta.enterprise.context.spi.Context getCurrentContext​(Class<? extends Annotation> scopeType,
                                                                        boolean createIfNotExists)
        Specified by:
        getCurrentContext in interface org.apache.webbeans.spi.ContextsService
        Overrides:
        getCurrentContext in class org.apache.webbeans.context.AbstractContextsService
      • getCurrentContext

        public jakarta.enterprise.context.spi.Context getCurrentContext​(Class<? extends Annotation> scopeType)
        Specified by:
        getCurrentContext in interface org.apache.webbeans.spi.ContextsService
        Overrides:
        getCurrentContext in class org.apache.webbeans.context.AbstractContextsService
      • startContext

        public void startContext​(Class<? extends Annotation> scopeType,
                                 Object startParameter)
                          throws jakarta.enterprise.context.ContextException
        Specified by:
        startContext in interface org.apache.webbeans.spi.ContextsService
        Overrides:
        startContext in class org.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 be null or different object for non-http SessionContexts. Such a context only lives for one thread.
      • sessionIsExpiring

        protected boolean sessionIsExpiring​(jakarta.servlet.http.HttpSession session)
        Returns:
        true if 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 - if true we will force creating a session if not yet exists. if false we 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