/** * @return The rendering context for this request. */ public RenderingContext getRenderingContext() { return delegate == null ? RenderingContext.GADGET : delegate.getRenderingContext(); }
@Override public RenderingContext getRenderingContext() { if (renderingContext == null) { return super.getRenderingContext(); } return renderingContext; }
@Override public RenderingContext getRenderingContext() { if (renderingContext == null) { return super.getRenderingContext(); } return renderingContext; }
/** * @return The rendering context for this request. */ public RenderingContext getRenderingContext() { return delegate == null ? RenderingContext.GADGET : delegate.getRenderingContext(); }
/** * @return The rendering context for this request. */ public RenderingContext getRenderingContext() { return delegate == null ? RenderingContext.GADGET : delegate.getRenderingContext(); }
@Override public RenderingContext getRenderingContext() { return renderingContext == null ? super.getRenderingContext() : renderingContext; }
protected String makeCacheKey(Collection<String> needed, GadgetContext ctx, List<String> unsupported) { List<String> neededList = Lists.newArrayList(needed); Collections.sort(neededList); return new StringBuilder().append(StringUtils.join(neededList, ":")) .append('|').append(ctx.getRenderingContext()) .append('|').append(ctx.getContainer()) .append('|').append(unsupported != null) .append('|').append(Strings.nullToEmpty(repository)) .toString(); }
private FeatureCacheKey(Collection<String> needed, GadgetContext ctx, boolean useUnsupported) { this.needed = needed; this.rCtx = ctx.getRenderingContext(); this.container = ctx.getContainer(); this.useUnsupported = useUnsupported; }
private FeatureCacheKey(Collection<String> needed, GadgetContext ctx, boolean useUnsupported) { this.needed = needed; this.rCtx = ctx.getRenderingContext(); this.container = ctx.getContainer(); this.useUnsupported = useUnsupported; }
if (ctx.getRenderingContext() == RenderingContext.CONTAINER) {
if (ctx.getRenderingContext() == RenderingContext.CONTAINER) {
String targetBundleType = ctx.getRenderingContext() == RenderingContext.CONTAINER ? "container" : "gadget"; ImmutableList.Builder<FeatureResource> resourcesBuilder = new ImmutableList.Builder<FeatureResource>();
String targetBundleType = ctx.getRenderingContext() == RenderingContext.CONTAINER ? "container" : "gadget"; ImmutableList.Builder<FeatureResource> resourcesBuilder = new ImmutableList.Builder<FeatureResource>();
private Gadget mockGadget(boolean nocache, boolean debug, boolean isContainer) { GadgetContext context = createMock(GadgetContext.class); expect(context.getContainer()).andReturn(CONTAINER).anyTimes(); expect(context.getIgnoreCache()).andReturn(nocache).anyTimes(); expect(context.getDebug()).andReturn(debug).anyTimes(); expect(context.getUrl()).andReturn(GADGET_URI).anyTimes(); expect(context.getRenderingContext()).andReturn( isContainer ? RenderingContext.CONTAINER : RenderingContext.GADGET).anyTimes(); replay(context); return new Gadget().setContext(context); }
boolean specificContainerMatched = false; List<FeatureBundle> noContainerBundles = Lists.newLinkedList(); for (FeatureBundle bundle : entry.getBundles(ctx.getRenderingContext())) { String containerAttrib = bundle.getAttribs().get("container"); if (containerAttrib != null) {
public boolean process(JsRequest request, JsResponseBuilder builder) throws JsException { JsUri jsUri = request.getJsUri(); GadgetContext ctx = new JsGadgetContext(jsUri); FeatureRegistry registry; try { registry = registryProvider.get(jsUri.getRepository()); } catch (GadgetException e) { throw new JsException(e.getHttpStatusCode(), e.getMessage()); } // Append gadgets.config initialization if not in standard gadget mode. if (ctx.getRenderingContext() != RenderingContext.GADGET) { List<String> allReq = registry.getFeatures(jsUri.getLibs()); Collection<String> loaded = jsUri.getLoadedLibs(); // Only inject config for features not already present and configured. List<String> newReq = subtractCollection(allReq, loaded); Map<String, Object> config = configProcessor.getConfig( ctx.getContainer(), newReq, request.getHost(), null); if (!config.isEmpty()) { String configJson = JsonSerializer.serialize(config); if (allReq.contains(CONFIG_FEATURE) || loaded.contains(CONFIG_FEATURE)) { // config lib is present: pass it data injectBaseConfig(configJson, builder); } else { // config lib not available: use global variable injectGlobalConfig(configJson, builder); } } } return true; }
gadget.getContext().getRenderingContext() == RenderingContext.CONTAINER ? "1" : "0");
gadget.getContext().getRenderingContext() == RenderingContext.CONTAINER ? "1" : "0");