private void addVersionAndSplitParam(UriBuilder uriBuilder, String splitParam, boolean doSplit, List<Uri> batchUris, String container, Type type) { // HashCode is used to differentiate splitParam paramter across ConcatUris // within single page/url. This value is appended to the splitParam value which // is recieved from config container. int hashCode = uriBuilder.hashCode(); if (doSplit) { uriBuilder.addQueryParameter(Param.JSON.getKey(), (splitParam + String.valueOf(Math.abs(hashCode)))); } if (versioner != null) { List<List<Uri>> batches = Lists.newArrayList(); List<String> resourceTags = Lists.newArrayList(); batches.add(batchUris); resourceTags.add(type.getTagName().toLowerCase()); List<String> versions = versioner.version(batches, container, resourceTags); if (versions != null && versions.size() == 1) { String version = versions.get(0); if (version != null) { uriBuilder.addQueryParameter(Param.VERSION.getKey(), version); } } } }
public VisitStatus visit(Gadget gadget, Node node) throws RewritingException { // Reserve JS nodes; always if there's an adjacent rewritable JS node and also when // directed to support split-resource concatenation if (node.getNodeType() != Node.ELEMENT_NODE || !node.getNodeName().equalsIgnoreCase(type.getTagName())) { return VisitStatus.BYPASS; } Element element = (Element)node; if (isRewritableExternData(element)) { if (split || isRewritableExternData(getSibling(element, true)) || isRewritableExternData(getSibling(element, false))) { return VisitStatus.RESERVE_NODE; } } return VisitStatus.BYPASS; }
public VisitStatus visit(Gadget gadget, Node node) throws RewritingException { // Reserve JS nodes; always if there's an adjacent rewritable JS node and also when // directed to support split-resource concatenation if (node.getNodeType() != Node.ELEMENT_NODE || !node.getNodeName().equalsIgnoreCase(type.getTagName())) { return VisitStatus.BYPASS; } Element element = (Element)node; if (isRewritableExternData(element)) { if (split || singleResourceConcat || isRewritableExternData(getSibling(element, true)) || isRewritableExternData(getSibling(element, false))) { return VisitStatus.RESERVE_NODE; } } return VisitStatus.BYPASS; }
public VisitStatus visit(Gadget gadget, Node node) throws RewritingException { // Reserve JS nodes; always if there's an adjacent rewritable JS node and also when // directed to support split-resource concatenation if (node.getNodeType() != Node.ELEMENT_NODE || !node.getNodeName().equalsIgnoreCase(type.getTagName())) { return VisitStatus.BYPASS; } Element element = (Element)node; if (isRewritableExternData(element)) { if (split || isRewritableExternData(getSibling(element, true)) || isRewritableExternData(getSibling(element, false))) { return VisitStatus.RESERVE_NODE; } } return VisitStatus.BYPASS; }