Example usage for org.apache.shiro.io ResourceUtils hasResourcePrefix

List of usage examples for org.apache.shiro.io ResourceUtils hasResourcePrefix

Introduction

In this page you can find the example usage for org.apache.shiro.io ResourceUtils hasResourcePrefix.

Prototype

@SuppressWarnings({ "UnusedDeclaration" })
public static boolean hasResourcePrefix(String resourcePath) 

Source Link

Document

Returns true if the resource path is not null and starts with one of the recognized resource prefixes ( #CLASSPATH_PREFIX CLASSPATH_PREFIX , #URL_PREFIX URL_PREFIX , or #FILE_PREFIX FILE_PREFIX ), false otherwise.

Usage

From source file:org.ehcache.integrations.shiro.EhcacheShiroManager.java

License:Apache License

private URL getResource() throws MalformedURLException {
    String cacheManagerConfigFile = getCacheManagerConfigFile();
    String configFileWithoutPrefix = stripPrefix(cacheManagerConfigFile);
    if (cacheManagerConfigFile.startsWith(ResourceUtils.CLASSPATH_PREFIX)) {
        return ClassUtils.getResource(configFileWithoutPrefix);
    }//from   w  ww. j  a v  a2  s .  co m

    String url = ResourceUtils.hasResourcePrefix(cacheManagerConfigFile) ? configFileWithoutPrefix
            : cacheManagerConfigFile;

    return new URL(url);
}