@Override public String getContainer() { if (container == null) { return super.getContainer(); } return container; }
/** * @return The container of the current request. */ public String getContainer() { return delegate == null ? ContainerConfig.DEFAULT_CONTAINER : delegate.getContainer(); }
/** * @return The container of the current request. */ public String getContainer() { return delegate == null ? ContainerConfig.DEFAULT_CONTAINER : delegate.getContainer(); }
@Override public String getContainer() { if (container == null) { return super.getContainer(); } return container; }
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(); }
public ProxyUri(Gadget gadget, Uri resource) { super(gadget); this.resource = resource; if (AccelUriManager.CONTAINER.equals(gadget.getContext().getContainer())) { setReturnOriginalContentOnError(true); } if(authType == null) { authType = AuthType.NONE; } }
private Uri getSocialUri(GadgetContext context, String token) { String jsonUri = config.getString(context.getContainer(), "gadgets.osDataUri"); Preconditions.checkNotNull(jsonUri, "No JSON URI available for social preloads"); Preconditions.checkNotNull(token, "No token available for social preloads"); UriBuilder builder = UriBuilder.parse( jsonUri.replace("%host%", context.getHost())) .addQueryParameter("st", token); return builder.toUri(); } }
private Uri getSocialUri(GadgetContext context, String token) { String jsonUri = config.getString(context.getContainer(), "gadgets.osDataUri"); Preconditions.checkNotNull(jsonUri, "No JSON URI available for social preloads"); Preconditions.checkNotNull(token, "No token available for social preloads"); UriBuilder builder = UriBuilder.parse( jsonUri.replace("%host%", context.getHost())) .addQueryParameter("st", token); return builder.toUri(); } }
/** {@inheritDoc} */ public void contribute(Map<String, Object> config, Gadget gadget) { GadgetContext ctx = gadget.getContext(); addServicesConfig(config, ctx.getContainer(), ctx.getHost()); }
/** {@inheritDoc} */ public void contribute(Map<String, Object> config, Gadget gadget) { GadgetContext ctx = gadget.getContext(); addServicesConfig(config, ctx.getContainer(), ctx.getHost()); }
private GadgetContext mockGadgetContext(String container) { GadgetContext mockContext = control.createMock(GadgetContext.class); EasyMock.expect(mockContext.getContainer()).andReturn(container).anyTimes(); return mockContext; }
private GadgetContext mockGadgetContext(String container) { GadgetContext mockContext = control.createMock(GadgetContext.class); EasyMock.expect(mockContext.getContainer()).andReturn(container).anyTimes(); return mockContext; }
public void addSubstitutions(Substitutions substituter, GadgetContext context, GadgetSpec spec) throws GadgetException { MessageBundle bundle = messageBundleFactory.getBundle(spec, context.getLocale(), context.getIgnoreCache(), context.getContainer()); substituter.addSubstitutions(Substitutions.Type.MESSAGE, bundle.getMessages()); } }
private Gadget makeGadget() throws GadgetException { Gadget gadget = EasyMock.createNiceMock(Gadget.class); GadgetContext context = EasyMock.createNiceMock(GadgetContext.class); expect(context.getUrl()).andReturn(Uri.parse("http://example.com/gadget.xml")).anyTimes(); expect(context.getContainer()).andReturn("cajaContainer").anyTimes(); expect(context.getDebug()).andReturn(false).anyTimes(); expect(gadget.getContext()).andReturn(context).anyTimes(); expect(gadget.getAllFeatures()).andReturn(ImmutableList.of("caja")).anyTimes(); expect(gadget.requiresCaja()).andReturn(true).anyTimes(); replay(context, gadget); return gadget; }
public void addSubstitutions(Substitutions substituter, GadgetContext context, GadgetSpec spec) throws GadgetException { MessageBundle bundle = messageBundleFactory.getBundle(spec, context.getLocale(), context.getIgnoreCache(), context.getContainer(), context.getView()); String dir = bundle.getLanguageDirection(); boolean rtl = RTL.equals(dir); substituter.addSubstitution(Substitutions.Type.BIDI, START_EDGE, rtl ? RIGHT : LEFT); substituter.addSubstitution(Substitutions.Type.BIDI, END_EDGE, rtl ? LEFT : RIGHT); substituter.addSubstitution(Substitutions.Type.BIDI, DIR, rtl ? RTL : LTR); substituter.addSubstitution(Substitutions.Type.BIDI, REVERSE_DIR, rtl ? LTR : RTL); } }
protected ProxyUriBase(Gadget gadget) { this(null, // Meaningless in "context" mode. translateStatusRefresh invalid here. getIntegerValue(gadget.getContext().getParameter(Param.REFRESH.getKey())), gadget.getContext().getDebug(), gadget.getContext().getIgnoreCache(), gadget.getContext().getContainer(), gadget.getSpec().getUrl().toString()); }
public static HttpRequest newHttpRequest(GadgetContext context, RequestAuthenticationInfo authenticationInfo) throws GadgetException { return new HttpRequest(authenticationInfo.getHref()) .setSecurityToken(context.getToken()) .setOAuthArguments(new OAuthArguments(authenticationInfo)) .setAuthType(authenticationInfo.getAuthType()) .setContainer(context.getContainer()) .setGadget(context.getUrl()) .setIgnoreCache(context.getIgnoreCache()); }
public static HttpRequest newHttpRequest(GadgetContext context, RequestAuthenticationInfo authenticationInfo) throws GadgetException { return new HttpRequest(authenticationInfo.getHref()) .setSecurityToken(context.getToken()) .setOAuthArguments(new OAuthArguments(authenticationInfo)) .setOAuth2Arguments(new OAuth2Arguments(authenticationInfo)) .setAuthType(authenticationInfo.getAuthType()) .setContainer(context.getContainer()) .setGadget(context.getUrl()) .setIgnoreCache(context.getIgnoreCache()); }
private void checkRequest(HttpRequest request) { assertEquals(context.getContainer(), request.getContainer()); assertEquals(GADGET_URL.toString(), request.getGadget().toString()); assertEquals(context.getToken().getAppId(), request.getSecurityToken().getAppId()); }
private void checkRequest(HttpRequest request) { assertEquals(context.getContainer(), request.getContainer()); assertEquals(GADGET_URL.toString(), request.getGadget().toString()); assertEquals(context.getToken().getAppId(), request.getSecurityToken().getAppId()); }