Example usage for org.apache.shiro.web.env ResourceBasedWebEnvironment setConfigLocations

List of usage examples for org.apache.shiro.web.env ResourceBasedWebEnvironment setConfigLocations

Introduction

In this page you can find the example usage for org.apache.shiro.web.env ResourceBasedWebEnvironment setConfigLocations.

Prototype

public void setConfigLocations(String[] configLocations) 

Source Link

Usage

From source file:org.apache.jena.fuseki.server.ShiroEnvironmentLoader.java

License:Apache License

/** 
 * Normal Shiro initialization only supports one location for an INI file.
 *  /*  w w  w  .ja va2  s  .co  m*/
 * When given multiple locations for the shiro.ini file, and 
 * if a {@link ResourceBasedWebEnvironment}, check the list of configuration
 * locations, testing whether the name identified an existing resource.  
 * For the first resource name found to exist, reset the {@link ResourceBasedWebEnvironment}
 * to name that resource alone so the normal Shiro initialization  
 */
@Override
protected void customizeEnvironment(WebEnvironment environment) {
    if (environment instanceof ResourceBasedWebEnvironment) {
        ResourceBasedWebEnvironment env = (ResourceBasedWebEnvironment) environment;
        String[] locations = env.getConfigLocations();
        String loc = huntForShiroIni(locations);
        Fuseki.configLog.info("Shiro file: " + loc);
        if (loc != null)
            locations = new String[] { loc };
        env.setConfigLocations(locations);
    }
}