org.apache.shiro.web.env
Class IniWebEnvironment

java.lang.Object
  extended by org.apache.shiro.env.DefaultEnvironment
      extended by org.apache.shiro.web.env.DefaultWebEnvironment
          extended by org.apache.shiro.web.env.ResourceBasedWebEnvironment
              extended by org.apache.shiro.web.env.IniWebEnvironment
All Implemented Interfaces:
ResourceConfigurable, Environment, NamedObjectEnvironment, Destroyable, Initializable, MutableWebEnvironment, WebEnvironment

public class IniWebEnvironment
extends ResourceBasedWebEnvironment
implements Initializable, Destroyable

WebEnvironment implementation configured by an Ini instance or Ini resource locations.

Since:
1.2

Field Summary
static String DEFAULT_WEB_INI_RESOURCE_PATH
           
 
Fields inherited from class org.apache.shiro.env.DefaultEnvironment
DEFAULT_SECURITY_MANAGER_KEY, objects
 
Constructor Summary
IniWebEnvironment()
           
 
Method Summary
protected  void configure()
           
protected  FilterChainResolver createFilterChainResolver()
           
protected  Ini createIni(String configLocation, boolean required)
          Creates an Ini instance reflecting the specified path, or null if the path does not exist and is not required.
protected  WebSecurityManager createWebSecurityManager()
           
protected  String[] getDefaultConfigLocations()
          Returns an array with two elements, /WEB-INF/shiro.ini and classpath:shiro.ini.
protected  Ini getDefaultIni()
           
 Ini getIni()
          Returns the Ini instance reflecting this WebEnvironment's configuration.
protected  Ini getSpecifiedIni(String[] configLocations)
           
 void init()
          Initializes this instance by resolving any potential (explicit or resource-configured) Ini configuration and calling configure for actual instance configuration.
 void setIni(Ini ini)
          Allows for configuration via a direct Ini instance instead of via config locations.
 
Methods inherited from class org.apache.shiro.web.env.ResourceBasedWebEnvironment
getConfigLocations, setConfigLocations, setConfigLocations
 
Methods inherited from class org.apache.shiro.web.env.DefaultWebEnvironment
getFilterChainResolver, getSecurityManager, getServletContext, getWebSecurityManager, setFilterChainResolver, setSecurityManager, setServletContext, setWebSecurityManager
 
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
 
Methods inherited from interface org.apache.shiro.util.Destroyable
destroy
 

Field Detail

DEFAULT_WEB_INI_RESOURCE_PATH

public static final String DEFAULT_WEB_INI_RESOURCE_PATH
See Also:
Constant Field Values
Constructor Detail

IniWebEnvironment

public IniWebEnvironment()
Method Detail

init

public void init()
Initializes this instance by resolving any potential (explicit or resource-configured) Ini configuration and calling configure for actual instance configuration.

Specified by:
init in interface Initializable

configure

protected void configure()

getSpecifiedIni

protected Ini getSpecifiedIni(String[] configLocations)
                       throws ConfigurationException
Throws:
ConfigurationException

getDefaultIni

protected Ini getDefaultIni()

createIni

protected Ini createIni(String configLocation,
                        boolean required)
                 throws ConfigurationException
Creates an Ini instance reflecting the specified path, or null if the path does not exist and is not required.

If the path is required and does not exist or is empty, a ConfigurationException will be thrown.

Parameters:
configLocation - the resource path to load into an Ini instance.
required - if the path must exist and be converted to a non-empty Ini instance.
Returns:
an Ini instance reflecting the specified path, or null if the path does not exist and is not required.
Throws:
ConfigurationException - if the path is required but results in a null or empty Ini instance.

createFilterChainResolver

protected FilterChainResolver createFilterChainResolver()

createWebSecurityManager

protected WebSecurityManager createWebSecurityManager()

getDefaultConfigLocations

protected String[] getDefaultConfigLocations()
Returns an array with two elements, /WEB-INF/shiro.ini and classpath:shiro.ini.

Returns:
an array with two elements, /WEB-INF/shiro.ini and classpath:shiro.ini.

getIni

public Ini getIni()
Returns the Ini instance reflecting this WebEnvironment's configuration.

Returns:
the Ini instance reflecting this WebEnvironment's configuration.

setIni

public void setIni(Ini ini)
Allows for configuration via a direct Ini instance instead of via config locations.

If the specified instance is null or empty, the fallback/default resource-based configuration will be used.

Parameters:
ini - the ini instance to use for creation.


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