/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); BundleAttributeNames assetsAttributeName = (BundleAttributeNames) AttributesUtil.find(strippedAttributeName, BundleAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext context = AssetRequestContext.get(request); switch (assetsAttributeName) { case INCLUDES: context.addBundles(element.getAttributeValue(attributeName)); break; case EXCLUDES: context.excludeBundles(element.getAttributeValue(attributeName)); break; } return ProcessorResult.ok(); } }
/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); BundleAttributeNames assetsAttributeName = (BundleAttributeNames) AttributesUtil.find(strippedAttributeName, BundleAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext context = AssetRequestContext.get(request); switch (assetsAttributeName) { case INCLUDES: context.addBundles(element.getAttributeValue(attributeName)); break; case EXCLUDES: context.excludeBundles(element.getAttributeValue(attributeName)); break; } return ProcessorResult.ok(); } }
/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); AssetAttributeNames assetsAttributeName = (AssetAttributeNames) AttributesUtil.find(strippedAttributeName, AssetAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); switch (assetsAttributeName) { case JS_EXCLUDES: arc.excludeJs(element.getAttributeValue(attributeName)); break; case CSS_EXCLUDES: arc.excludeCss(element.getAttributeValue(attributeName)); break; default: break; } return ProcessorResult.ok(); } }
/** * {@inheritDoc} */ @Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); AssetAttributeNames assetsAttributeName = (AssetAttributeNames) AttributesUtil.find(strippedAttributeName, AssetAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); switch (assetsAttributeName) { case JS_EXCLUDES: arc.excludeJs(element.getAttributeValue(attributeName)); break; case CSS_EXCLUDES: arc.excludeCss(element.getAttributeValue(attributeName)); break; default: break; } return ProcessorResult.ok(); } }
@Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); PlaceholderAttributeNames placeholderAttributeName = (PlaceholderAttributeNames) AttributesUtil .find(strippedAttributeName, PlaceholderAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); String attributeValue = element.getAttributeValue(attributeName); if (StringUtils.isBlank(attributeValue)) { throw new DandelionException("The \"type\" attribute cannot be blank. Possible values: \"" + PLACEHOLDER_TYPE_JS + "\" or \"" + PLACEHOLDER_TYPE_CSS + "\"."); } String placeholder = "dandelionPlaceholder" + attributeValue; handlePlaceholder(attributeValue, arc, placeholder); switch (placeholderAttributeName) { // Include a new Text node containing the placeholder within the existing // element case PLACEHOLDER_INCLUDE: Text text = new Text(placeholder); element.insertChild(element.getChildren().size(), text); break; // Replace the current element by the placeholder case PLACEHOLDER_REPLACE: text = new Text(placeholder); element.clearChildren(); element.addChild(text); break; } return ProcessorResult.ok(); }
@Override protected ProcessorResult doProcessAttribute(Arguments arguments, Element element, String attributeName) { String strippedAttributeName = AttributesUtil.stripPrefix(attributeName, DandelionDialect.DIALECT_PREFIX); PlaceholderAttributeNames placeholderAttributeName = (PlaceholderAttributeNames) AttributesUtil .find(strippedAttributeName, PlaceholderAttributeNames.values()); HttpServletRequest request = ArgumentsUtil.getWebContext(arguments).getHttpServletRequest(); AssetRequestContext arc = AssetRequestContext.get(request); String attributeValue = element.getAttributeValue(attributeName); if (StringUtils.isBlank(attributeValue)) { throw new DandelionException("The \"type\" attribute cannot be blank. Possible values: \"" + PLACEHOLDER_TYPE_JS + "\" or \"" + PLACEHOLDER_TYPE_CSS + "\"."); } String placeholder = "dandelionPlaceholder" + attributeValue; handlePlaceholder(attributeValue, arc, placeholder); switch (placeholderAttributeName) { // Include a new Text node containing the placeholder within the existing // element case PLACEHOLDER_INCLUDE: Text text = new Text(placeholder); element.insertChild(element.getChildren().size(), text); break; // Replace the current element by the placeholder case PLACEHOLDER_REPLACE: text = new Text(placeholder); element.clearChildren(); element.addChild(text); break; } return ProcessorResult.ok(); }