Package org.apache.shiro.web.env
Class EnvironmentLoaderListener
- java.lang.Object
-
- org.apache.shiro.web.env.EnvironmentLoader
-
- org.apache.shiro.web.env.EnvironmentLoaderListener
-
- All Implemented Interfaces:
EventListener,javax.servlet.ServletContextListener
public class EnvironmentLoaderListener extends EnvironmentLoader implements javax.servlet.ServletContextListener
Bootstrap listener to startup and shutdown the web application's ShiroWebEnvironmentat ServletContext startup and shutdown respectively. This class exists only to implement theServletContextListenerinterface. All 'real' logic is done in the parentEnvironmentLoaderclass.Usage
Define the following inweb.xml:<listener> <listener-class>Configuration options, such as theorg.apache.shiro.web.env.EnvironmentLoaderListener</listener-class> </listener>WebEnvironmentclass to instantiate as well as Shiro configuration resource locations are specified asServletContextcontext-params and are documented in theEnvironmentLoaderJavaDoc.Shiro Filter
This listener is almost always defined in conjunction with theShiroFilterto ensure security operations for web requests. Please see theShiroFilterJavaDoc for more.- Since:
- 1.2
- See Also:
EnvironmentLoader,ShiroFilter
-
-
Field Summary
-
Fields inherited from class org.apache.shiro.web.env.EnvironmentLoader
CONFIG_LOCATIONS_PARAM, ENVIRONMENT_ATTRIBUTE_KEY, ENVIRONMENT_CLASS_PARAM
-
-
Constructor Summary
Constructors Constructor Description EnvironmentLoaderListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextDestroyed(javax.servlet.ServletContextEvent sce)Destroys any previously created/boundWebEnvironmentinstance created by thecontextInitialized(javax.servlet.ServletContextEvent)method.voidcontextInitialized(javax.servlet.ServletContextEvent sce)Initializes the ShiroWebEnvironmentand binds it to theServletContextat application startup for future reference.-
Methods inherited from class org.apache.shiro.web.env.EnvironmentLoader
createEnvironment, customizeEnvironment, destroyEnvironment, determineWebEnvironment, determineWebEnvironmentClass, finalizeEnvironment, getDefaultWebEnvironmentClass, initEnvironment
-
-
-
-
Method Detail
-
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent sce)
Initializes the ShiroWebEnvironmentand binds it to theServletContextat application startup for future reference.- Specified by:
contextInitializedin interfacejavax.servlet.ServletContextListener- Parameters:
sce- the ServletContextEvent triggered upon application startup
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent sce)
Destroys any previously created/boundWebEnvironmentinstance created by thecontextInitialized(javax.servlet.ServletContextEvent)method.- Specified by:
contextDestroyedin interfacejavax.servlet.ServletContextListener- Parameters:
sce- the ServletContextEvent triggered upon application shutdown
-
-