public Config get(final Uri gadgetUri) { GadgetSpec spec; if (gadgetUri != null) { try { GadgetContext context = new GadgetContext() { @Override public Uri getUrl() { return gadgetUri; } }; spec = specFactory.getGadgetSpec(context); if (spec != null) { return get(spec); } } catch (GadgetException ge) { // Falls through to default. } } return defaultConfig; }
Uri url = gadgetSpecFactory.getGadgetUri(context); spec = gadgetSpecFactory.getGadgetSpec(context); spec = substituter.substitute(context, spec);
public Config get(final Uri gadgetUri) { GadgetSpec spec; if (gadgetUri != null) { try { GadgetContext context = new GadgetContext() { @Override public Uri getUrl() { return gadgetUri; } }; spec = specFactory.getGadgetSpec(context); if (spec != null) { return get(spec); } } catch (GadgetException ge) { // Falls through to default. } } return defaultConfig; }
private GadgetSpec findSpec(final SecurityToken securityToken, final OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); return specFactory.getGadgetSpec(context); } catch (IllegalArgumentException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec, gadget URI invalid.", e); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec", e); } }
private GadgetSpec findSpec(final SecurityToken securityToken, final OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); return specFactory.getGadgetSpec(context); } catch (IllegalArgumentException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec, gadget URI invalid.", e); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec", e); } }
private GadgetSpec findSpec(final SecurityToken securityToken, final OAuthArguments arguments, OAuthResponseParams responseParams) throws OAuthRequestException { try { GadgetContext context = new OAuthGadgetContext(securityToken, arguments); return specFactory.getGadgetSpec(context); } catch (IllegalArgumentException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec, gadget URI invalid.", e); } catch (GadgetException e) { throw new OAuthRequestException(OAuthError.UNKNOWN_PROBLEM, "Could not fetch gadget spec", e); } }
public Config get(HttpRequest request) { GadgetSpec spec; final Uri gadgetUrl = request.getGadget(); final boolean isIgnoreCache = request.getIgnoreCache(); if (gadgetUrl != null) { try { GadgetContext context = new GadgetContext() { @Override public Uri getUrl() { return gadgetUrl; } @Override public boolean getIgnoreCache() { return isIgnoreCache; } }; spec = specFactory.getGadgetSpec(context); if (spec != null) { return get(spec); } } catch (GadgetException ge) { // Falls through to default. } } return defaultConfig.get(); }
GadgetSpec spec = gadgetSpecFactory.getGadgetSpec(context); spec = substituter.substitute(context, spec);
GadgetSpec spec = gadgetSpecFactory.getGadgetSpec(context); spec = substituter.substitute(context, spec);
@Test public void ttlPropagatesToPipeline() throws Exception { CapturingPipeline capturingPipeline = new CapturingPipeline(); GadgetSpecFactory forcedCacheFactory = new DefaultGadgetSpecFactory( new ImmediateExecutorService(), capturingPipeline, cacheProvider, 10000); forcedCacheFactory.getGadgetSpec(createContext(SPEC_URL, false)); assertEquals(10, capturingPipeline.request.getCacheTtl()); }
@Test public void ttlPropagatesToPipeline() throws Exception { CapturingPipeline capturingPipeline = new CapturingPipeline(); GadgetSpecFactory forcedCacheFactory = new DefaultGadgetSpecFactory( new ImmediateExecutorService(), capturingPipeline, cacheProvider, 10000); forcedCacheFactory.getGadgetSpec(createContext(SPEC_URL, false)); assertEquals(10, capturingPipeline.request.getCacheTtl()); }
@Test public void ttlPropagatesToPipeline() throws Exception { CapturingPipeline capturingPipeline = new CapturingPipeline(); GadgetSpecFactory forcedCacheFactory = new DefaultGadgetSpecFactory( new TestExecutorService(), capturingPipeline, cacheProvider, 10000); forcedCacheFactory.getGadgetSpec(createContext(SPEC_URL, false)); assertEquals(10, capturingPipeline.request.getCacheTtl()); }
ret = this.specFactory.getGadgetSpec(context); } catch (final IllegalArgumentException e) { if (isLogging) {
@Test public void specRequestMarkedWithAnonymousToken() throws Exception { CapturingPipeline capturingPipeline = new CapturingPipeline(); GadgetSpecFactory factory = new DefaultGadgetSpecFactory( new CountingExecutor(), capturingPipeline, cacheProvider, 10000); factory.getGadgetSpec(createContext(SPEC_URL, false)); SecurityToken st = capturingPipeline.request.getSecurityToken(); assertNotNull(st); assertTrue( st.isAnonymous() ); assertEquals( SPEC_URL.toString(), st.getAppUrl() ); }
@Test public void specRequestMarkedWithAnonymousToken() throws Exception { CapturingPipeline capturingPipeline = new CapturingPipeline(); GadgetSpecFactory factory = new DefaultGadgetSpecFactory( new CountingExecutor(), capturingPipeline, cacheProvider, 10000); factory.getGadgetSpec(createContext(SPEC_URL, false)); SecurityToken st = capturingPipeline.request.getSecurityToken(); assertNotNull(st); assertTrue( st.isAnonymous() ); assertEquals( SPEC_URL.toString(), st.getAppUrl() ); }