congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BundleAction
Code IndexAdd Tabnine to your IDE (free)

How to use
BundleAction
in
jodd.htmlstapler

Best Java code snippets using jodd.htmlstapler.BundleAction (Showing top 12 results out of 315)

origin: oblac/jodd

/**
 * Starts bundle usage by creating new {@link BundleAction}.
 */
public BundleAction start(final String servletPath, final String bundleName) {
  return new BundleAction(this, servletPath, bundleName);
}
origin: oblac/jodd

/**
 * Process links. Returns bundle link if this is the first resource
 * of the same type. Otherwise, returns <code>null</code> indicating
 * that collection is going on and the original link should be removed.
 */
public String processLink(final String src) {
  if (newAction) {
    if (bundleId == null) {
      bundleId = bundlesManager.registerNewBundleId();
      bundleId += '.' + bundleContentType;
    }
    sources.add(src);
  }
  if (firstScriptTag) {
    // this is the first tag, change the url to point to the bundle
    firstScriptTag = false;
    return buildStaplerUrl();
  } else {
    // ignore all other script tags
    return null;
  }
}
origin: oblac/jodd

@Override
public void end() {
  jsBundleAction.end();
  cssBundleAction.end();
  super.end();
}
origin: oblac/jodd

@Override
public void script(final Tag tag, final CharSequence body) {
  if (!insideConditionalComment) {
    String src = Util.toString(tag.getAttributeValue("src"));
    if (src == null) {
      super.script(tag, body);
      return;
    }
    if (jsBundleAction.acceptLink(src)) {
      String link = jsBundleAction.processLink(src);
      if (link != null) {
        tag.setAttributeValue("src", link);
        super.script(tag, body);
      }
      return;
    }
  }
  super.script(tag, body);
}
origin: oblac/jodd

  /**
   * Post process final content. Required for <code>RESOURCE_ONLY</code> strategy.
   */
  public char[] postProcess(char[] content) {
    content = jsBundleAction.replaceBundleId(content);
    content = cssBundleAction.replaceBundleId(content);
    return content;
  }
}
origin: oblac/jodd

@Override
public void tag(final Tag tag) {
  if (!insideConditionalComment) {
    if (tag.nameEquals(T_LINK)) {
      CharSequence type = tag.getAttributeValue("type");
      if (type != null && CharSequenceUtil.equalsIgnoreCase(type, "text/css")) {
        String media = Util.toString(tag.getAttributeValue("media"));
        if (media == null || media.contains("screen")) {
          String href = Util.toString(tag.getAttributeValue("href"));
          if (cssBundleAction.acceptLink(href)) {
            String link = cssBundleAction.processLink(href);
            if (link != null) {
              tag.setAttribute("href", link);
              super.tag(tag);
            }
            return;
          }
        }
      }
    }
  }
  super.tag(tag);
}
origin: org.jodd/jodd-htmlstapler

  /**
   * Post process final content. Required for <code>RESOURCE_ONLY</code> strategy.
   */
  public char[] postProcess(char[] content) {
    content = jsBundleAction.replaceBundleId(content);
    content = cssBundleAction.replaceBundleId(content);
    return content;
  }
}
origin: org.jodd/jodd-htmlstapler

@Override
public void script(final Tag tag, final CharSequence body) {
  if (!insideConditionalComment) {
    String src = Util.toString(tag.getAttributeValue("src"));
    if (src == null) {
      super.script(tag, body);
      return;
    }
    if (jsBundleAction.acceptLink(src)) {
      String link = jsBundleAction.processLink(src);
      if (link != null) {
        tag.setAttributeValue("src", link);
        super.script(tag, body);
      }
      return;
    }
  }
  super.script(tag, body);
}
origin: org.jodd/jodd-htmlstapler

@Override
public void end() {
  jsBundleAction.end();
  cssBundleAction.end();
  super.end();
}
origin: org.jodd/jodd-htmlstapler

/**
 * Starts bundle usage by creating new {@link BundleAction}.
 */
public BundleAction start(final String servletPath, final String bundleName) {
  return new BundleAction(this, servletPath, bundleName);
}
origin: org.jodd/jodd-htmlstapler

/**
 * Process links. Returns bundle link if this is the first resource
 * of the same type. Otherwise, returns <code>null</code> indicating
 * that collection is going on and the original link should be removed.
 */
public String processLink(final String src) {
  if (newAction) {
    if (bundleId == null) {
      bundleId = bundlesManager.registerNewBundleId();
      bundleId += '.' + bundleContentType;
    }
    sources.add(src);
  }
  if (firstScriptTag) {
    // this is the first tag, change the url to point to the bundle
    firstScriptTag = false;
    return buildStaplerUrl();
  } else {
    // ignore all other script tags
    return null;
  }
}
origin: org.jodd/jodd-htmlstapler

@Override
public void tag(final Tag tag) {
  if (!insideConditionalComment) {
    if (tag.nameEquals(T_LINK)) {
      CharSequence type = tag.getAttributeValue("type");
      if (type != null && CharSequenceUtil.equalsIgnoreCase(type, "text/css")) {
        String media = Util.toString(tag.getAttributeValue("media"));
        if (media == null || media.contains("screen")) {
          String href = Util.toString(tag.getAttributeValue("href"));
          if (cssBundleAction.acceptLink(href)) {
            String link = cssBundleAction.processLink(href);
            if (link != null) {
              tag.setAttribute("href", link);
              super.tag(tag);
            }
            return;
          }
        }
      }
    }
  }
  super.tag(tag);
}
jodd.htmlstaplerBundleAction

Javadoc

Bundle action used during page parsing and resources collection.

Most used methods

  • <init>
    Creates new bundle action.
  • acceptLink
    Returns true if resource link should be collected into the bundle. Returnsfalse for resources that
  • buildStaplerUrl
    Builds stapler URL based on bundle action data.
  • end
    Called on end of parsing.
  • processLink
    Process links. Returns bundle link if this is the first resource of the same type. Otherwise, return
  • replaceBundleId
    Replaces bundle marker with calculated bundle id. Used for RESOURCE_ONLY strategy.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getResourceAsStream (ClassLoader)
  • getApplicationContext (Context)
  • getSystemService (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Notification (javax.management)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now