/** * Install 2 default collector instances: (FileAssetPathCollector(WEBJARS_PATH_PREFIX), JarAssetPathCollector), * and a webjars resource finder. * * <p> * Factored out for easy (informal) pluggability. * </p> */ protected void configureWebJars() { IWebjarsSettings settings = new WebjarsSettings(); WicketWebjars.install(this, settings); }
@Override public void init(WebApplication webApplication) { WebjarsSettings settings = new WebjarsSettings(); WicketWebjars.install(webApplication, settings); wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass()) .withDetail("properties", props) .build()); }
@Override public void init(WebApplication webApplication) { WebjarsSettings settings = new WebjarsSettings(); WicketWebjars.install(webApplication, settings); wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass()) .withDetail("properties", props) .build()); }
/** * https://github.com/l0rdn1kk0n/wicket-webjars/issues/22 * * Parse the version of the correct asset when there is an asset * with a similar name but with a prefix */ @Test public void correctVersion() { AssetsMap assetsMap = new AssetsMap(new WebjarsSettings()) { @Override public Set<String> listAssets(String folderPath) { Set<String> assets = new HashSet<String>(); assets.add("/webjars/realname/3.0.0/prefix.realname.js"); assets.add("/webjars/realname/2.0.0/realname.js"); return assets; } }; String versionFor = assetsMap.findRecentVersionFor("realname/current/realname.js"); assertThat(versionFor, is(equalTo("2.0.0"))); } }
/** * 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); } }