public override List<preloadProcessor> createPreloadTasks(GadgetContext context, GadgetSpec gadget, PreloaderService.PreloadPhase phase) { List<preloadProcessor> preloads = new List<preloadProcessor>(); if (phase == PreloaderService.PreloadPhase.HTML_RENDER) { foreach(Preload preload in gadget.getModulePrefs().getPreloads()) { HashSet<String> preloadViews = preload.getViews(); if (preloadViews.Count == 0 || preloadViews.Contains(context.getView())) { PreloadTask task = new PreloadTask(context, preload, preload.getHref().ToString()); preloads.Add(new preloadProcessor(task.call)); } } } return preloads; }
/** * Create new preload tasks for the provided gadget. * * @param context The request that needs preloading. * @param gadget The gadget that the operations will be performed for. * @return Preloading tasks that will be executed by * {@link PreloaderService#preload(GadgetContext, GadgetSpec)}. */ public abstract List<preloadProcessor> createPreloadTasks(GadgetContext context, GadgetSpec gadget, PreloaderService.PreloadPhase phase);
public HtmlRenderer() { requestPipeline = DefaultRequestPipeline.Instance; preloader = new ConcurrentPreloaderService(); rewriter = DefaultContentRewriterRegistry.Instance; }