public String locate(String path) { try { if (path.startsWith("~./")) { path = Servlets.locate( _ctx, _request, ClassWebResource.PATH_PREFIX + path.substring(2), Locators.getDefault()); return "~." + path.substring(ClassWebResource.PATH_PREFIX.length()); } return Servlets.locate(_ctx, _request, path, null); } catch (ServletException ex) { throw new UiException(ex); } }
// called by Provider InputStream getResourceAsStream(HttpServletRequest request, String path, boolean locate) throws IOException, ServletException { if (locate) path = Servlets.locate(_webctx.getServletContext(), request, path, _webctx.getLocator()); if (_cache.getCheckPeriod() >= 0) { // Due to Web server might cache the result, we use URL if possible try { URL url = _webctx.getResource(path); if (url != null) return url.openStream(); } catch (Throwable ex) { log.warningBriefly("Unable to read from URL: " + path, ex); } } // Note: _webctx will handle the renaming for debugJS (.src.js) return _webctx.getResourceAsStream(path); }