/**
   * Returns the resource input stream
   *
   * @param config the Jawr config
   * @param path the resource path
   * @return the resource input stream
   */
  private InputStream getResourceInputStream(JawrConfig config, String path) {
    InputStream is = config.getContext().getResourceAsStream(path);
    if (is == null) {
      try {
        is = ClassLoaderResourceUtils.getResourceAsStream(path, this);
      } catch (FileNotFoundException e) {
        throw new BundlingProcessException(e);
      }
    }

    return is;
  }
예제 #2
0
  /**
   * The constructor
   *
   * @param config the jawr config
   */
  public EhCacheManager(JawrConfig config) {

    super(config);
    String configPath = config.getProperty(JAWR_EHCACHE_CONFIG_PATH, DEFAULT_EHCACHE_CONFIG_PATH);
    String cacheName = config.getProperty(JAWR_EHCACHE_CACHE_NAME);
    try {
      CacheManager cacheMgr =
          CacheManager.create(ClassLoaderResourceUtils.getResourceAsStream(configPath, this));
      cache = cacheMgr.getCache(cacheName);

    } catch (Exception e) {
      LOGGER.error("Unable to load EHCACHE configuration file", e);
    }
  }