/** * {@inheritDoc} */ @Override public String getResourceFinders() { StringBuilder builder = new StringBuilder(); for (IResourceFinder rf : application.getResourceSettings().getResourceFinders()) { builder.append(Stringz.className(rf)); } return builder.toString(); }
public IResourceStreamLocator getResourceStreamLocator() { if (resourceStreamLocator == null) { // Create compound resource locator using source path from // application settings resourceStreamLocator = new ResourceStreamLocator(getResourceFinders()); resourceStreamLocator = new CachingResourceStreamLocator(resourceStreamLocator); } return resourceStreamLocator; }
@Override public IResourceStreamLocator getResourceStreamLocator() { if (resourceStreamLocator == null) { // Create compound resource locator using source path from // application settings resourceStreamLocator = new ResourceStreamLocator(getResourceFinders()); resourceStreamLocator = new CachingResourceStreamLocator(resourceStreamLocator); } return resourceStreamLocator; }
/** * Adds the given resourcePath to the resource finder from the given application. * * @param application * the application * @param resourcePath * the resource path * @see org.apache.wicket.settings.ResourceSettings#getResourceFinders() */ public static void addResourceFinder(final WebApplication application, final String resourcePath) { application.getResourceSettings().getResourceFinders() .add(new WebApplicationPath(application.getServletContext(), resourcePath)); }
public static void reindex(final WebApplication application) { final List<IResourceFinder> resourceFinders = application.getResourceSettings().getResourceFinders(); for (IResourceFinder resourceFinder : resourceFinders) { if (resourceFinder instanceof WebjarsResourceFinder) { WebjarsVersion.reset(); WebjarsResourceFinder webjarsResourceFinder = (WebjarsResourceFinder) resourceFinder; webjarsResourceFinder.reindex(); break; } } }
public static void reindex(final WebApplication application) { final List<IResourceFinder> resourceFinders = application.getResourceSettings().getResourceFinders(); for (IResourceFinder resourceFinder : resourceFinders) { if (resourceFinder instanceof WebjarsResourceFinder) { WebjarsVersion.reset(); WebjarsResourceFinder webjarsResourceFinder = (WebjarsResourceFinder) resourceFinder; webjarsResourceFinder.reindex(); break; } } }
/** * * @see org.apache.wicket.core.util.resource.locator.IResourceStreamLocator#locate(java.lang.Class, * java.lang.String) */ @Override public IResourceStream locate(final Class<?> clazz, final String path) { // First try with the resource finder registered with the application // (allows for markup reloading) if (finders == null) { finders = Application.get().getResourceSettings().getResourceFinders(); } IResourceStream result; for (IResourceFinder finder : finders) { log.debug("Attempting to locate resource '{}' using finder'{}'", path, finder); result = finder.find(clazz, path); if (result != null) { return result; } } return null; }
/** * * @see org.apache.wicket.core.util.resource.locator.IResourceStreamLocator#locate(java.lang.Class, * java.lang.String) */ @Override public IResourceStream locate(final Class<?> clazz, final String path) { // First try with the resource finder registered with the application // (allows for markup reloading) if (finders == null) { finders = Application.get().getResourceSettings().getResourceFinders(); } IResourceStream result; for (IResourceFinder finder : finders) { log.debug("Attempting to locate resource '{}' using finder'{}'", path, finder); result = finder.find(clazz, path); if (result != null) { return result; } } return null; }
/** * installs the webjars resource finder * * @param app the wicket application * @param settings the settings to use */ public static void install(WebApplication app, IWebjarsSettings settings) { final IWebjarsSettings existingSettings = settings(app); if (existingSettings == null) { if (settings == null) { settings = new WebjarsSettings(); } app.setMetaData(WEBJARS_SETTINGS_METADATA_KEY, settings); if (settings.useCdnResources()) { mountCDNMapper(app, settings.cdnUrl()); } final List<IResourceFinder> finders = app.getResourceSettings().getResourceFinders(); final WebjarsResourceFinder finder = new WebjarsResourceFinder(settings); if (!finders.contains(finder)) { finders.add(finder); } LOG.info("initialize wicket webjars with given settings: {}", settings); } }
/** * installs the webjars resource finder * * @param app the wicket application * @param settings the settings to use */ public static void install(WebApplication app, IWebjarsSettings settings) { final IWebjarsSettings existingSettings = settings(app); if (existingSettings == null) { if (settings == null) { settings = new WebjarsSettings(); } app.setMetaData(WEBJARS_SETTINGS_METADATA_KEY, settings); if (settings.useCdnResources()) { mountCDNMapper(app, settings.cdnUrl()); } final List<IResourceFinder> finders = app.getResourceSettings().getResourceFinders(); final WebjarsResourceFinder finder = new WebjarsResourceFinder(settings); if (!finders.contains(finder)) { finders.add(finder); } LOG.info("initialize wicket webjars with given settings: {}", settings); } }
getResourceSettings().getResourceFinders().add( new WebApplicationPath(getServletContext(), "")); getResourceSettings().getResourceFinders().add( new ClassPathResourceFinder(META_INF_RESOURCES)); if (resourceFolder != null) getResourceSettings().getResourceFinders().add(new Path(resourceFolder));
getResourceSettings().getResourceFinders().add( new WebApplicationPath(getServletContext(), "")); getResourceSettings().getResourceFinders().add( new ClassPathResourceFinder(META_INF_RESOURCES)); if (resourceFolder != null) getResourceSettings().getResourceFinders().add(new Path(resourceFolder));
pageSettings.addComponentResolver(new WicketContainerResolver()); getResourceSettings().getResourceFinders().add(new ClassPathResourceFinder(""));
pageSettings.addComponentResolver(new WicketContainerResolver()); getResourceSettings().getResourceFinders().add(new ClassPathResourceFinder(""));