/** * Primary, and only public, method of FeatureResourceLoader. Loads the resource * keyed at the given {@code uri}, which was decorated with the provided list of attributes. * * The default implementation loads both file and res-schema resources using * ResourceLoader, attempting to load optimized content for files named [file].js as [file].opt.js. * * Override this method to provide custom functionality. Basic loadFile, loadResource, and loadUri * methods are kept protected for easy reuse. * * @param uri Uri of resource to be loaded. * @param attribs Attributes decorating the resource in the corresponding feature.xml * @return FeatureResource object providing content and debugContent loading capability. * @throws GadgetException If any failure occurs during this process. */ public FeatureResource load(Uri uri, Map<String, String> attribs) throws GadgetException { try { if ("file".equals(uri.getScheme())) { return loadFile(uri.getPath(), attribs); } else if ("res".equals(uri.getScheme())) { return loadResource(uri.getPath(), attribs); } return loadUri(uri, attribs); } catch (IOException e) { throw new GadgetException(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT, e); } }
/** * Primary, and only public, method of FeatureResourceLoader. Loads the resource * keyed at the given {@code uri}, which was decorated with the provided list of attributes. * * The default implementation loads both file and res-schema resources using * ResourceLoader, attempting to load optimized content for files named [file].js as [file].opt.js. * * Override this method to provide custom functionality. Basic loadFile, loadResource, and loadUri * methods are kept protected for easy reuse. * * @param uri Uri of resource to be loaded. * @param attribs Attributes decorating the resource in the corresponding feature.xml * @return FeatureResource object providing content and debugContent loading capability. * @throws GadgetException If any failure occurs during this process. */ public FeatureResource load(Uri uri, Map<String, String> attribs) throws GadgetException { try { if ("file".equals(uri.getScheme())) { return loadFile(uri.getPath(), attribs); } else if ("res".equals(uri.getScheme())) { return loadResource(uri.getPath(), attribs); } return loadUri(uri, attribs); } catch (IOException e) { throw new GadgetException(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT, e); } }
/** * Primary, and only public, method of FeatureResourceLoader. Loads the resource * keyed at the given {@code uri}, which was decorated with the provided list of attributes. * * The default implementation loads both file and res-schema resources using * ResourceLoader, attempting to load optimized content for files named [file].js as [file].opt.js. * * Override this method to provide custom functionality. Basic loadFile, loadResource, and loadUri * methods are kept protected for easy reuse. * * @param uri Uri of resource to be loaded. * @param attribs Attributes decorating the resource in the corresponding feature.xml * @return FeatureResource object providing content and debugContent loading capability. * @throws GadgetException If any failure occurs during this process. */ public FeatureResource load(Uri uri, Map<String, String> attribs) throws GadgetException { try { if ("file".equals(uri.getScheme())) { return loadFile(uri.getPath(), attribs); } else if ("res".equals(uri.getScheme())) { return loadResource(uri.getPath(), attribs); } return loadUri(uri, attribs); } catch (IOException e) { throw new GadgetException(GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT, e); } }