@Override protected boolean resourceAvailable(String resourceName) { return ResourceUtils.getClasspathResourceURL(resourceName, RequestDispatcherProvider.class, getBus()) != null; } }
public static URL getResourceURL(String loc, Bus bus) throws Exception { URL url = null; if (loc.startsWith(CLASSPATH_PREFIX)) { String path = loc.substring(CLASSPATH_PREFIX.length()); url = ResourceUtils.getClasspathResourceURL(path, ResourceUtils.class, bus); } else { try { url = new URL(loc); } catch (Exception ex) { // it can be either a classpath or file resource without a scheme url = ResourceUtils.getClasspathResourceURL(loc, ResourceUtils.class, bus); if (url == null) { File file = new File(loc); if (file.exists()) { url = file.toURI().toURL(); } } } } if (url == null) { LOG.warning("No resource " + loc + " is available"); } return url; }
public static URL getResourceURL(String loc, Bus bus) throws Exception { URL url = null; if (loc.startsWith(CLASSPATH_PREFIX)) { String path = loc.substring(CLASSPATH_PREFIX.length()); url = ResourceUtils.getClasspathResourceURL(path, ResourceUtils.class, bus); } else { try { url = new URL(loc); } catch (Exception ex) { // it can be either a classpath or file resource without a scheme url = ResourceUtils.getClasspathResourceURL(loc, ResourceUtils.class, bus); if (url == null) { File file = new File(loc); if (file.exists()) { url = file.toURI().toURL(); } } } } if (url == null) { LOG.warning("No resource " + loc + " is available"); } return url; }
protected static CacheManager createCacheManager(String configFile, Bus bus) throws Exception { if (bus == null) { bus = BusFactory.getThreadDefaultBus(true); } CachingProvider provider = Caching.getCachingProvider(); URI configFileURI; try { configFileURI = getClasspathResourceURL(configFile, JCacheOAuthDataProvider.class, bus).toURI(); } catch (Exception ex) { configFileURI = provider.getDefaultURI(); } return provider.getCacheManager(configFileURI, Thread.currentThread().getContextClassLoader()); }
protected static CacheManager createCacheManager(String configFile, Bus bus) throws Exception { if (bus == null) { bus = BusFactory.getThreadDefaultBus(true); } CachingProvider provider = Caching.getCachingProvider(); URI configFileURI; try { configFileURI = getClasspathResourceURL(configFile, JCacheOAuthDataProvider.class, bus).toURI(); } catch (Exception ex) { configFileURI = provider.getDefaultURI(); } return provider.getCacheManager(configFileURI, Thread.currentThread().getContextClassLoader()); }
URL url = ResourceUtils.getClasspathResourceURL(resource, SourceGenerator.class, bus);
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) { if (useClassNames && ResourceUtils.getClasspathResourceURL(getClassResourceName(type), RequestDispatcherProvider.class, getBus()) != null) { return true; } if (resourcePath != null || classResourceSupported(type)) { return true; } if (!resourcePaths.isEmpty()) { String path = getRequestPath(); for (String requestPath : resourcePaths.keySet()) { boolean result = strictPathCheck ? path.endsWith(requestPath) : path.contains(requestPath); if (result) { return true; } } } if (mc != null && mc.get(MESSAGE_RESOURCE_PATH_PROPERTY) != null) { return true; } return false; }
if (configFileURI == null) { try { configFileURI = getClasspathResourceURL(options.getJcacheConfigUri(), JCacheOAuthDataProvider.class, bus).toURI(); } catch (final Exception ex) { configFileURI = provider.getDefaultURI();
private void createCache(String configFile, Bus bus) { if (bus == null) { bus = BusFactory.getThreadDefaultBus(true); } URL configFileURL = null; try { configFileURL = ResourceUtils.getClasspathResourceURL(configFile, EHCacheTokenReplayCache.class, bus); } catch (Exception ex) { // ignore } if (configFileURL == null) { cacheManager = EHCacheUtil.createCacheManager(); } else { Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL); if (bus != null) { conf.setName(bus.getId()); DiskStoreConfiguration dsc = conf.getDiskStoreConfiguration(); if (dsc != null && "java.io.tmpdir".equals(dsc.getOriginalPath())) { String path = conf.getDiskStoreConfiguration().getPath() + File.separator + bus.getId(); conf.getDiskStoreConfiguration().setPath(path); } } cacheManager = EHCacheUtil.createCacheManager(conf); } CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(CACHE_KEY, cacheManager); Ehcache newCache = new Cache(cc); cache = cacheManager.addCacheIfAbsent(newCache); }
try { configFileURL = ResourceUtils.getClasspathResourceURL(configFile, EHCacheSPStateManager.class, bus); } catch (Exception ex) {