/** * Iterate through list and call {@link WebApplication#mount(IRequestMapper)} for each item. * <p> * Typically called from {@link WebApplication#init()} method * * @param app * The web application. * @see AnnotatedMountScanner */ public void mount(WebApplication app) { for (IRequestMapper strategy : this) { app.mount(strategy); } } }
/** * Iterate through list and call {@link WebApplication#mount(IRequestTargetUrlCodingStrategy)} * for each item. * <p> * Typically called from {@link WebApplication#init()} method * @param app The web application. * @see AnnotatedMountScanner */ public void mount(WebApplication app) { for (IRequestTargetUrlCodingStrategy strategy : this) { app.mount(strategy); } } }
/** * Mounts a shared resource class to the given path. * * @param path * the path to mount the resource class on * @param resourceKey * the shared key of the resource being mounted */ public final void mountSharedResource(final String path, final String resourceKey) { mount(new SharedResourceRequestTargetUrlCodingStrategy(path, resourceKey)); }
/** * Mounts a bookmarkable page class to the given path. * * @param path * the path to mount the bookmarkable page class on * @param bookmarkablePageClass * the bookmarkable page class to mount */ public final void mountBookmarkablePage(final String path, final Class bookmarkablePageClass) { mount(new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, null)); }
/** * Mounts a shared resource class to the given path. * * @param path * the path to mount the resource class on * @param resourceKey * the shared key of the resource being mounted */ public final void mountSharedResource(final String path, final String resourceKey) { mount(new SharedResourceRequestTargetUrlCodingStrategy(path, resourceKey)); }
/** * Mounts a bookmarkable page class to the given path. * * @param <T> * type of page * * @param path * the path to mount the bookmarkable page class on * @param bookmarkablePageClass * the bookmarkable page class to mount */ public final <T extends Page> void mountBookmarkablePage(final String path, final Class<T> bookmarkablePageClass) { mount(new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, null)); }
/** * Mounts a bookmarkable page class to the given pagemap and path. * * @param path * the path to mount the bookmarkable page class on * @param pageMapName * name of the pagemap this mount is for * @param bookmarkablePageClass * the bookmarkable page class to mount */ public final void mountBookmarkablePage(final String path, final String pageMapName, final Class bookmarkablePageClass) { mount(new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, pageMapName)); }
/** * Mounts all bookmarkable pages at the given path. * * @param path * the path to mount the bookmarkable page class on * @param packageName * the name of the package for which all bookmarkable pages or sharedresources should * be mounted */ public final void mount(final String path, final PackageName packageName) { if (packageName == null) { throw new IllegalArgumentException("PackageName cannot be null"); } mount(new PackageRequestTargetUrlCodingStrategy(path, packageName)); }
/** * Mounts all bookmarkable pages at the given path. * * @param path * the path to mount the bookmarkable page class on * @param packageName * the name of the package for which all bookmarkable pages or sharedresources should * be mounted */ public final void mount(final String path, final PackageName packageName) { if (packageName == null) { throw new IllegalArgumentException("PackageName cannot be null"); } mount(new PackageRequestTargetUrlCodingStrategy(path, packageName)); }
/** * Mounts a bookmarkable page class to the given pagemap and path. * * @param <T> * type of page * * @param path * the path to mount the bookmarkable page class on * @param pageMapName * name of the pagemap this mount is for * @param bookmarkablePageClass * the bookmarkable page class to mount */ public final <T extends Page> void mountBookmarkablePage(final String path, final String pageMapName, final Class<T> bookmarkablePageClass) { mount(new BookmarkablePageRequestTargetUrlCodingStrategy(path, bookmarkablePageClass, pageMapName)); }
/** * Mounts a page class to the given path. * * <p> * NOTE: mount path must not start with reserved URL segments! See {@link IMapperContext} to know * which segments are reserved for internal use. * </p> * @param <T> * type of page * * @param path * the path to mount the page class on * @param pageClass * the page class to be mounted */ public <T extends Page> MountedMapper mountPage(final String path, final Class<T> pageClass) { MountedMapper mapper = new MountedMapper(path, pageClass); mount(mapper); return mapper; }
/** * Mounts a page class to the given path. * * <p> * NOTE: mount path must not start with reserved URL segments! See {@link IMapperContext} to know * which segments are reserved for internal use. * </p> * @param <T> * type of page * * @param path * the path to mount the page class on * @param pageClass * the page class to be mounted */ public <T extends Page> MountedMapper mountPage(final String path, final Class<T> pageClass) { MountedMapper mapper = new MountedMapper(path, pageClass); mount(mapper); return mapper; }
public static boolean mountAll(WebApplication app) { final String mapInfoClassName = app.getClass().getCanonicalName() + "MountInfo"; try { final MountInfo mountInfo = (MountInfo) WicketObjects.newInstance(mapInfoClassName); for(IRequestMapper mapper: mountInfo.getMountList()) { app.mount(mapper); } return true; } catch (Exception ex) { LOG.warn("Failed to automount pages.",ex); return false; } } }
/** * Mounts mounts all bookmarkable pages in a the pageClass's package to the given path. * * <p> * NOTE: mount path must not start with reserved URL segments! See {@link IMapperContext} to know * which segments are reserved for internal use. * </p> * @param <P> * type of page * * @param path * the path to mount the page class on * @param pageClass * the page class to be mounted */ public <P extends Page> PackageMapper mountPackage(final String path, final Class<P> pageClass) { PackageMapper packageMapper = new PackageMapper(path, PackageName.forClass(pageClass)); mount(packageMapper); return packageMapper; }
/** * Mounts mounts all bookmarkable pages in a the pageClass's package to the given path. * * <p> * NOTE: mount path must not start with reserved URL segments! See {@link IMapperContext} to know * which segments are reserved for internal use. * </p> * @param <P> * type of page * * @param path * the path to mount the page class on * @param pageClass * the page class to be mounted */ public <P extends Page> PackageMapper mountPackage(final String path, final Class<P> pageClass) { PackageMapper packageMapper = new PackageMapper(path, PackageName.forClass(pageClass)); mount(packageMapper); return packageMapper; }
@Override public final Object addingService(ServiceReference reference) { PageMounter mounter = (PageMounter) super.addingService(reference); List<MountPointInfo> infos = mounter.getMountPoints(); for (MountPointInfo info : infos) { IRequestTargetUrlCodingStrategy strategy = info.getCodingStrategy(); LOGGER.trace("Make sure that path {} is clear before trying to remount", info.getPath()); application.unmount(info.getPath()); LOGGER.trace("Trying to mount {} with {}", info.getPath(), info.getCodingStrategy().toString()); application.mount(strategy); LOGGER.info("Mounted {} with {}", info.getPath(), info.getCodingStrategy().toString()); } return mounter; }
/** * Mounts a shared resource to the given path. * * <p> * NOTE: mount path must not start with reserved URL segments! See {@link IMapperContext} to know * which segments are reserved for internal use. * </p> * @param path * the path to mount the resource reference on * @param reference * resource reference to be mounted */ public ResourceMapper mountResource(final String path, final ResourceReference reference) { if (reference.canBeRegistered()) { getResourceReferenceRegistry().registerResourceReference(reference); } ResourceMapper mapper = new ResourceMapper(path, reference); mount(mapper); return mapper; }
/** * mounts a special resource reference mapper that transform webjars resource urls into a cdn url. * * @param app current web app * @param cdnUrl the cdn url to use */ private static void mountCDNMapper(final WebApplication app, String cdnUrl) { Supplier<String> parentFolderPlaceholderProvider = () -> app.getResourceSettings().getParentFolderPlaceholder(); Supplier<IResourceCachingStrategy> cachingStrategyProvider = () -> app.getResourceSettings().getCachingStrategy(); LOG.info("use cdn resources from {}", cdnUrl); IRequestMapper delegate = new ResourceReferenceMapper(new PageParametersEncoder(), parentFolderPlaceholderProvider, cachingStrategyProvider); app.mount(new WebjarsCDNRequestMapper(delegate, cdnUrl, cachingStrategyProvider)); }
/** * Creates and registers an {@code EventBus} for the given application and broadcaster * * @param application * @param broadcaster */ public EventBus(WebApplication application, Broadcaster broadcaster) { this.application = application; this.broadcaster = broadcaster; application.setMetaData(EVENT_BUS_KEY, this); application.mount(new AtmosphereRequestMapper(createEventSubscriptionInvoker())); application.getComponentPostOnBeforeRenderListeners().add( createEventSubscriptionCollector()); application.getSessionStore().registerUnboundListener(this); }
/** * Creates and registers an {@code EventBus} for the given application and broadcaster * * @param application * @param broadcaster */ public EventBus(WebApplication application, Broadcaster broadcaster) { this.application = application; this.broadcaster = broadcaster; application.setMetaData(EVENT_BUS_KEY, this); application.mount(new AtmosphereRequestMapper(createEventSubscriptionInvoker())); application.getComponentPostOnBeforeRenderListeners().add( createEventSubscriptionCollector()); application.getSessionStore().registerUnboundListener(this); checkEnabledAnalytics(getBroadcaster().getBroadcasterConfig().getAtmosphereConfig()); }