/** * Looks for a given path name along the webjars root path * * @param clazz The class requesting the resource stream * @param pathName The filename with possible path * @return The resource stream */ @Override public IResourceStream find(final Class<?> clazz, final String pathName) { IResourceStream stream = null; if (clazz != null && IWebjarsResourceReference.class.isAssignableFrom(clazz)) { final int pos = pathName != null ? pathName.lastIndexOf(Helper.PATH_PREFIX) : -1; if (pos > -1) { try { final String webjarsPath = locator.getFullPath(pathName.substring(pos)); LOG.debug("webjars path: {}", webjarsPath); stream = newResourceStream(webjarsPath); } catch (Exception e) { LOG.debug("can't locate resource for: {}; {}", pathName, e.getMessage()); } if (stream == null) { LOG.debug("there is no webjars resource for: {}", pathName); } } } return stream; }
/** * Looks for a given path name along the webjars root path * * @param clazz The class requesting the resource stream * @param pathName The filename with possible path * @return The resource stream */ @Override public IResourceStream find(final Class<?> clazz, final String pathName) { IResourceStream stream = null; if (clazz != null && IWebjarsResourceReference.class.isAssignableFrom(clazz)) { String versionnedName = WebjarsVersion.useRecent(pathName); final int pos = versionnedName != null ? versionnedName.lastIndexOf(Helper.PATH_PREFIX) : -1; if (pos > -1) { try { final String webjarsPath = locator.getFullPath(versionnedName.substring(pos)); LOG.debug("webjars path: {}", webjarsPath); stream = newResourceStream(webjarsPath); } catch (Exception e) { LOG.debug("can't locate resource for: {} (actual name {}); {}", pathName, versionnedName, e.getMessage()); } if (stream == null) { LOG.debug("there is no webjars resource for: {} (actual name {})", pathName, versionnedName); } } } return stream; }