/** * <p> * Adds the given collection of bundles to the current * {@link AssetRequestContext}. * </p> * * @param bundles * A collection of bundle names. * @return the current {@link AssetRequestContext}. */ public AssetRequestContext excludeBundles(Collection<String> bundles) { for (String bundle : bundles) { excludeBundles(bundle); } return this; }
/** * <p> * Adds the given collection of bundles to the current * {@link AssetRequestContext}. * </p> * * @param bundles * A collection of bundle names. * @return the current {@link AssetRequestContext}. */ public AssetRequestContext excludeBundles(Collection<String> bundles) { for (String bundle : bundles) { excludeBundles(bundle); } return this; }
/** * <p> * Excludes a comma-separated list of bundle names from the current * {@link AssetRequestContext}. * * @param bundles * A comma-separated list of bundle names to exclude. * @return the current {@link AssetRequestContext}. */ public AssetRequestContext excludeBundles(String bundles) { if (bundles == null || bundles.isEmpty()) { return this; } return excludeBundles(bundles.split(",")); }
/** * <p> * Excludes a comma-separated list of bundle names from the current * {@link AssetRequestContext}. * * @param bundles * A comma-separated list of bundle names to exclude. * @return the current {@link AssetRequestContext}. */ public AssetRequestContext excludeBundles(String bundles) { if (bundles == null || bundles.isEmpty()) { return this; } return excludeBundles(bundles.split(",")); }
public int doEndTag() throws JspException { AssetRequestContext.get(pageContext.getRequest()).addBundles(includes).excludeBundles(excludes); return EVAL_PAGE; }
public int doEndTag() throws JspException { AssetRequestContext.get(pageContext.getRequest()).addBundles(includes).excludeBundles(excludes); return EVAL_PAGE; }
AssetRequestContext.get(request).excludeBundles(STANDALONE_BUNDLES_TO_EXCLUDE);
AssetRequestContext.get(request).excludeBundles(STANDALONE_BUNDLES_TO_EXCLUDE);
/** * <p> * Returns the {@link AssetRequestContext} associated to the passed * {@link ServletRequest}. * </p> * <p> * If it doesn't exist, a new instance is created and stored as a request * attribute. * </p> * * @param servletRequest * The servlet request in which is stored the * {@link AssetRequestContext}. * @return the instance of {@link AssetRequestContext} associated with the * current servlet request. */ public static AssetRequestContext get(ServletRequest servletRequest) { Object attribute = servletRequest.getAttribute(AssetRequestContext.class.getCanonicalName()); Context context = (Context) servletRequest.getAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE); if (attribute == null || !(attribute instanceof AssetRequestContext)) { attribute = new AssetRequestContext(); ((AssetRequestContext) attribute).addBundles(context.getConfiguration().getBundleIncludes()); ((AssetRequestContext) attribute).excludeBundles(context.getConfiguration().getBundleExcludes()); ((AssetRequestContext) attribute).excludeJs(context.getConfiguration().getAssetJsExcludes()); ((AssetRequestContext) attribute).excludeCss(context.getConfiguration().getAssetCssExcludes()); servletRequest.setAttribute(AssetRequestContext.class.getCanonicalName(), attribute); } return AssetRequestContext.class.cast(attribute); }
/** * <p> * Returns the {@link AssetRequestContext} associated to the passed * {@link ServletRequest}. * </p> * <p> * If it doesn't exist, a new instance is created and stored as a request * attribute. * </p> * * @param servletRequest * The servlet request in which is stored the * {@link AssetRequestContext}. * @return the instance of {@link AssetRequestContext} associated with the * current servlet request. */ public static AssetRequestContext get(ServletRequest servletRequest) { Object attribute = servletRequest.getAttribute(AssetRequestContext.class.getCanonicalName()); Context context = (Context) servletRequest.getAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE); if (attribute == null || !(attribute instanceof AssetRequestContext)) { attribute = new AssetRequestContext(); ((AssetRequestContext) attribute).addBundles(context.getConfiguration().getBundleIncludes()); ((AssetRequestContext) attribute).excludeBundles(context.getConfiguration().getBundleExcludes()); ((AssetRequestContext) attribute).excludeJs(context.getConfiguration().getAssetJsExcludes()); ((AssetRequestContext) attribute).excludeCss(context.getConfiguration().getAssetCssExcludes()); servletRequest.setAttribute(AssetRequestContext.class.getCanonicalName(), attribute); } return AssetRequestContext.class.cast(attribute); }
/** * {@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(); } }