Package org.apache.shiro.web.env
Class DefaultWebEnvironment
- java.lang.Object
-
- org.apache.shiro.env.DefaultEnvironment
-
- org.apache.shiro.web.env.DefaultWebEnvironment
-
- All Implemented Interfaces:
Environment
,NamedObjectEnvironment
,Destroyable
,MutableWebEnvironment
,WebEnvironment
- Direct Known Subclasses:
ResourceBasedWebEnvironment
public class DefaultWebEnvironment extends DefaultEnvironment implements MutableWebEnvironment
DefaultWebEnvironment
implementation based on a backingMap
instance.- Since:
- 1.2
-
-
Field Summary
-
Fields inherited from class org.apache.shiro.env.DefaultEnvironment
DEFAULT_SECURITY_MANAGER_KEY, objects
-
-
Constructor Summary
Constructors Constructor Description DefaultWebEnvironment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilterChainResolver
getFilterChainResolver()
Returns the web application'sFilterChainResolver
if one has been configured ornull
if one is not available.SecurityManager
getSecurityManager()
Returns the application'sSecurityManager
instance accessible in the backing map using thesecurityManagerName
property as the lookup key.ServletContext
getServletContext()
Returns theServletContext
associated with thisWebEnvironment
instance.WebSecurityManager
getWebSecurityManager()
Returns the web application's security manager instance.void
setFilterChainResolver(FilterChainResolver filterChainResolver)
Sets theWebEnvironment
'sFilterChainResolver
.void
setSecurityManager(SecurityManager securityManager)
void
setServletContext(ServletContext servletContext)
Sets theWebEnvironment
's associatedServletContext
instance.void
setWebSecurityManager(WebSecurityManager wsm)
Sets theWebEnvironment
'sWebSecurityManager
.-
Methods inherited from class org.apache.shiro.env.DefaultEnvironment
destroy, getObject, getObjects, getSecurityManagerName, lookupSecurityManager, setObject, setSecurityManagerName
-
-
-
-
Constructor Detail
-
DefaultWebEnvironment
public DefaultWebEnvironment()
-
-
Method Detail
-
getFilterChainResolver
public FilterChainResolver getFilterChainResolver()
Description copied from interface:WebEnvironment
Returns the web application'sFilterChainResolver
if one has been configured ornull
if one is not available.- Specified by:
getFilterChainResolver
in interfaceWebEnvironment
- Returns:
- the web application's
FilterChainResolver
if one has been configured ornull
if one is not available.
-
setFilterChainResolver
public void setFilterChainResolver(FilterChainResolver filterChainResolver)
Description copied from interface:MutableWebEnvironment
Sets theWebEnvironment
'sFilterChainResolver
.- Specified by:
setFilterChainResolver
in interfaceMutableWebEnvironment
- Parameters:
filterChainResolver
- theWebEnvironment
'sFilterChainResolver
.
-
getSecurityManager
public SecurityManager getSecurityManager() throws IllegalStateException
Description copied from class:DefaultEnvironment
Returns the application'sSecurityManager
instance accessible in the backing map using thesecurityManagerName
property as the lookup key. This implementation guarantees that a non-null instance is always returned, as this is expected for Environment API end-users. If subclasses have the need to perform the map lookup without this guarantee (for example, during initialization when the instance may not have been added to the map yet), theDefaultEnvironment.lookupSecurityManager()
method is provided as an alternative.- Specified by:
getSecurityManager
in interfaceEnvironment
- Overrides:
getSecurityManager
in classDefaultEnvironment
- Returns:
- the application's
SecurityManager
instance accessible in the backing map using thesecurityManagerName
property as the lookup key. - Throws:
IllegalStateException
-
setSecurityManager
public void setSecurityManager(SecurityManager securityManager)
- Overrides:
setSecurityManager
in classDefaultEnvironment
-
getWebSecurityManager
public WebSecurityManager getWebSecurityManager()
Description copied from interface:WebEnvironment
Returns the web application's security manager instance.- Specified by:
getWebSecurityManager
in interfaceWebEnvironment
- Returns:
- the web application's security manager instance.
-
setWebSecurityManager
public void setWebSecurityManager(WebSecurityManager wsm)
Description copied from interface:MutableWebEnvironment
Sets theWebEnvironment
'sWebSecurityManager
.- Specified by:
setWebSecurityManager
in interfaceMutableWebEnvironment
- Parameters:
wsm
- theWebEnvironment
'sWebSecurityManager
.
-
getServletContext
public ServletContext getServletContext()
Description copied from interface:WebEnvironment
Returns theServletContext
associated with thisWebEnvironment
instance. A web application typically only has a singleWebEnvironment
associated with itsServletContext
.- Specified by:
getServletContext
in interfaceWebEnvironment
- Returns:
- the
ServletContext
associated with thisWebEnvironment
instance.
-
setServletContext
public void setServletContext(ServletContext servletContext)
Description copied from interface:MutableWebEnvironment
Sets theWebEnvironment
's associatedServletContext
instance. Invoking this method merely makes theServletContext
available to the underlying instance - it does not trigger initialization behavior.- Specified by:
setServletContext
in interfaceMutableWebEnvironment
- Parameters:
servletContext
- theWebEnvironment
's associatedServletContext
instance.
-
-