String content = debug ? featureResource.getDebugContent() : featureResource.getContent(); if (!featureResource.isExternal()) { jsData.append(content); } else { isProxyCacheable = isProxyCacheable && featureResource.isProxyCacheable(); jsData.append(";\n");
public Map<String, String> getAttribs() { return delegate.getAttribs(); }
protected final List<JsContent> getSurfaceJsContents( FeatureRegistry featureRegistry, String featureName) { ImmutableList.Builder<JsContent> result = ImmutableList.builder(); LookupResult lookup = featureRegistry.getFeatureResources(context.get(), ImmutableList.of(featureName), null); for (FeatureBundle bundle : lookup.getBundles()) { for (FeatureResource resource : bundle.getResources()) { result.add(JsContent.fromFeature( resource.getDebugContent(), resource.getName(), bundle, resource)); } } return result.build(); }
protected String getFeatureContent(JsUri jsUri, FeatureResource resource) { return jsUri.isDebug() ? resource.getDebugContent() : resource.getContent(); } }
public Iterable<JsContent> getJsContent(JsUri jsUri, FeatureBundle bundle) { List<JsContent> jsContent = Lists.newLinkedList(); for (FeatureResource resource : bundle.getResources()) { String content = getFeatureContent(jsUri, resource); content = (content != null) ? content : ""; if (resource.isExternal()) { // Support external/type=url feature serving through document.write() jsContent.add(JsContent.fromFeature("document.write('<script src=\"" + content + "\"></script>')", "[external:" + content + ']', bundle, resource)); } else { jsContent.add(JsContent.fromFeature(content, resource.getName(), bundle, resource)); } jsContent.add(JsContent.fromFeature(";\n", "[separator]", bundle, resource)); } return jsContent; }
public String getContent() { if (browserMatches()) { return delegate.getContent(); } return ""; }
private FeatureResource mockResource(boolean external, String debContent, String optContent) { FeatureResource result = createMock(FeatureResource.class); expect(result.getDebugContent()).andReturn(debContent).anyTimes(); expect(result.getContent()).andReturn(optContent).anyTimes(); expect(result.isExternal()).andReturn(external).anyTimes(); expect(result.getName()).andReturn("source").anyTimes(); replay(result); return result; }
if (!resource.isExternal()) { if (context.getDebug()) { size += resource.getDebugContent().length(); } else { size += resource.getContent().length(); String theContent = context.getDebug() ? resource.getDebugContent() : resource.getContent(); if (resource.isExternal()) { if (inlineJs.length() > 0) { Element inlineTag = headTag.getOwnerDocument().createElement("script");
if (r.isExternal()) { builder.appendJs("<script src=\"" + r.getContent() + "\">", r.getName()); } else { builder.appendJs(r.getContent(), r.getName());
public boolean isProxyCacheable() { // If browser-specific (ie. browserMatch has some qualifiers in it), not proxy cacheable // (since the vast majority of browsers don't support Vary: User-Agent, we just say "false") // Otherwise, delegate this call. return browserMatch.isEmpty() ? delegate.isProxyCacheable() : false; }
public String getDebugContent() { if (browserMatches()) { return delegate.getDebugContent(); } return ""; }
public boolean isExternal() { return delegate.isExternal(); }
public String getName() { return delegate.getName(); }
public String getContent() { if (browserMatches()) { return delegate.getContent(); } return ""; }
@Inject public AllJsIframeVersioner(FeatureRegistry registry) { StringBuilder jsBuf = new StringBuilder(); for (FeatureResource resource : registry.getAllFeatures()) { jsBuf.append(resource.getContent()).append(resource.getDebugContent()); } allJsChecksum = HashUtil.checksum(jsBuf.toString().getBytes()); }
private FeatureResource mockResource(boolean external, String debContent, String optContent) { FeatureResource result = createMock(FeatureResource.class); expect(result.getDebugContent()).andReturn(debContent).anyTimes(); expect(result.getContent()).andReturn(optContent).anyTimes(); expect(result.isExternal()).andReturn(external).anyTimes(); expect(result.getName()).andReturn("source").anyTimes(); replay(result); return result; }
if (!resource.isExternal()) { if (context.getDebug()) { size += resource.getDebugContent().length(); } else { size += resource.getContent().length(); String theContent = context.getDebug() ? resource.getDebugContent() : resource.getContent(); if (resource.isExternal()) { if (inlineJs.length() > 0) { Element inlineTag = headTag.getOwnerDocument().createElement("script");
if (r.isExternal()) { builder.appendJs("<script src=\"" + r.getContent() + "\">", r.getName()); } else { builder.appendJs(r.getContent(), r.getName());
public boolean isProxyCacheable() { // If browser-specific (ie. browserMatch has some qualifiers in it), not proxy cacheable // (since the vast majority of browsers don't support Vary: User-Agent, we just say "false") // Otherwise, delegate this call. return browserMatch.isEmpty() ? delegate.isProxyCacheable() : false; }
public String getDebugContent() { if (browserMatches()) { return delegate.getDebugContent(); } return ""; }