FileDocCategorySizeDatePackage
ServletContextHolderListener.javaAPI DocExample2256Mon Jul 23 13:26:38 BST 2007org.apache.struts2.portlet.context

ServletContextHolderListener

public class ServletContextHolderListener extends Object implements ServletContextListener
Some of the factory/managers (e.g. the ObjectFactory) need access to the {@link org.apache.struts2.ServletActionContext} object when initializing. This {@link javax.servlet.ServletContextListener} keeps a reference to the {@link javax.servlet.ServletContext} and exposes it through a public static method.

Fields Summary
private static ServletContext
context
Constructors Summary
Methods Summary
public voidcontextDestroyed(javax.servlet.ServletContextEvent event)

see
javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)

        context = null;
    
public voidcontextInitialized(javax.servlet.ServletContextEvent event)
Stores the reference to the {@link ServletContext}.

see
javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)

        context = event.getServletContext();

    
public static javax.servlet.ServletContextgetServletContext()

return
The current servlet context


              
        
        return context;