org.apache.shiro.web.env
Class DefaultWebEnvironment

java.lang.Object
  extended by org.apache.shiro.env.DefaultEnvironment
      extended by 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

Default WebEnvironment implementation based on a backing Map instance.

Since:
1.2

Field Summary
 
Fields inherited from class org.apache.shiro.env.DefaultEnvironment
DEFAULT_SECURITY_MANAGER_KEY, objects
 
Constructor Summary
DefaultWebEnvironment()
           
 
Method Summary
 FilterChainResolver getFilterChainResolver()
          Returns the web application's FilterChainResolver if one has been configured or null if one is not available.
 SecurityManager getSecurityManager()
          Returns the application's SecurityManager instance accessible in the backing map using the securityManagerName property as the lookup key.
 ServletContext getServletContext()
          Returns the ServletContext associated with this WebEnvironment instance.
 WebSecurityManager getWebSecurityManager()
          Returns the web application's security manager instance.
 void setFilterChainResolver(FilterChainResolver filterChainResolver)
          Sets the WebEnvironment's FilterChainResolver.
 void setSecurityManager(SecurityManager securityManager)
           
 void setServletContext(ServletContext servletContext)
          Sets the WebEnvironment's associated ServletContext instance.
 void setWebSecurityManager(WebSecurityManager wsm)
          Sets the WebEnvironment's WebSecurityManager.
 
Methods inherited from class org.apache.shiro.env.DefaultEnvironment
destroy, getObject, getObjects, getSecurityManagerName, lookupSecurityManager, setObject, setSecurityManagerName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWebEnvironment

public DefaultWebEnvironment()
Method Detail

getFilterChainResolver

public FilterChainResolver getFilterChainResolver()
Description copied from interface: WebEnvironment
Returns the web application's FilterChainResolver if one has been configured or null if one is not available.

Specified by:
getFilterChainResolver in interface WebEnvironment
Returns:
the web application's FilterChainResolver if one has been configured or null if one is not available.

setFilterChainResolver

public void setFilterChainResolver(FilterChainResolver filterChainResolver)
Description copied from interface: MutableWebEnvironment
Sets the WebEnvironment's FilterChainResolver.

Specified by:
setFilterChainResolver in interface MutableWebEnvironment
Parameters:
filterChainResolver - the WebEnvironment's FilterChainResolver.

getSecurityManager

public SecurityManager getSecurityManager()
                                   throws IllegalStateException
Description copied from class: DefaultEnvironment
Returns the application's SecurityManager instance accessible in the backing map using the securityManagerName 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), the DefaultEnvironment.lookupSecurityManager() method is provided as an alternative.

Specified by:
getSecurityManager in interface Environment
Overrides:
getSecurityManager in class DefaultEnvironment
Returns:
the application's SecurityManager instance accessible in the backing map using the securityManagerName property as the lookup key.
Throws:
IllegalStateException

setSecurityManager

public void setSecurityManager(SecurityManager securityManager)
Overrides:
setSecurityManager in class DefaultEnvironment

getWebSecurityManager

public WebSecurityManager getWebSecurityManager()
Description copied from interface: WebEnvironment
Returns the web application's security manager instance.

Specified by:
getWebSecurityManager in interface WebEnvironment
Returns:
the web application's security manager instance.

setWebSecurityManager

public void setWebSecurityManager(WebSecurityManager wsm)
Description copied from interface: MutableWebEnvironment
Sets the WebEnvironment's WebSecurityManager.

Specified by:
setWebSecurityManager in interface MutableWebEnvironment
Parameters:
wsm - the WebEnvironment's WebSecurityManager.

getServletContext

public ServletContext getServletContext()
Description copied from interface: WebEnvironment
Returns the ServletContext associated with this WebEnvironment instance. A web application typically only has a single WebEnvironment associated with its ServletContext.

Specified by:
getServletContext in interface WebEnvironment
Returns:
the ServletContext associated with this WebEnvironment instance.

setServletContext

public void setServletContext(ServletContext servletContext)
Description copied from interface: MutableWebEnvironment
Sets the WebEnvironment's associated ServletContext instance. Invoking this method merely makes the ServletContext available to the underlying instance - it does not trigger initialization behavior.

Specified by:
setServletContext in interface MutableWebEnvironment
Parameters:
servletContext - the WebEnvironment's associated ServletContext instance.


Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.