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

How to use
lookupBundleFile
method
in
jodd.htmlstapler.HtmlStaplerBundlesManager

Best Java code snippets using jodd.htmlstapler.HtmlStaplerBundlesManager.lookupBundleFile (Showing top 2 results out of 315)

origin: oblac/jodd

@Override
protected boolean processActionPath(final HttpServletRequest servletRequest, final HttpServletResponse servletResponse, final String actionPath) throws IOException {
  String bundlePath = '/' + bundlesManager.getStaplerPath() + '/';
  if (!actionPath.startsWith(bundlePath)) {
    return false;
  }
  String bundleId = actionPath.substring(bundlePath.length());
  File file = bundlesManager.lookupBundleFile(bundleId);
  if (log.isDebugEnabled()) {
    log.debug("bundle: " + bundleId);
  }
  int ndx = bundleId.lastIndexOf('.');
  String extension = bundleId.substring(ndx + 1);
  String contentType = MimeTypes.getMimeType(extension);
  servletResponse.setContentType(contentType);
  if (useGzip && ServletUtil.isGzipSupported(servletRequest)) {
    file = bundlesManager.lookupGzipBundleFile(file);
    servletResponse.setHeader("Content-Encoding", "gzip");
  }
  if (!file.exists()) {
    throw new IOException("bundle not found: " + bundleId);
  }
  servletResponse.setHeader("Content-Length", String.valueOf(file.length()));
  servletResponse.setHeader("Last-Modified", TimeUtil.formatHttpDate(file.lastModified()));
  if (cacheMaxAge > 0) {
    servletResponse.setHeader("Cache-Control", "max-age=" + cacheMaxAge);
  }
  sendBundleFile(servletResponse, file);
  return true;
}
origin: org.jodd/jodd-htmlstapler

@Override
protected boolean processActionPath(final HttpServletRequest servletRequest, final HttpServletResponse servletResponse, final String actionPath) throws IOException {
  String bundlePath = '/' + bundlesManager.getStaplerPath() + '/';
  if (!actionPath.startsWith(bundlePath)) {
    return false;
  }
  String bundleId = actionPath.substring(bundlePath.length());
  File file = bundlesManager.lookupBundleFile(bundleId);
  if (log.isDebugEnabled()) {
    log.debug("bundle: " + bundleId);
  }
  int ndx = bundleId.lastIndexOf('.');
  String extension = bundleId.substring(ndx + 1);
  String contentType = MimeTypes.getMimeType(extension);
  servletResponse.setContentType(contentType);
  if (useGzip && ServletUtil.isGzipSupported(servletRequest)) {
    file = bundlesManager.lookupGzipBundleFile(file);
    servletResponse.setHeader("Content-Encoding", "gzip");
  }
  if (!file.exists()) {
    throw new IOException("bundle not found: " + bundleId);
  }
  servletResponse.setHeader("Content-Length", String.valueOf(file.length()));
  servletResponse.setHeader("Last-Modified", TimeUtil.formatHttpDate(file.lastModified()));
  if (cacheMaxAge > 0) {
    servletResponse.setHeader("Cache-Control", "max-age=" + cacheMaxAge);
  }
  sendBundleFile(servletResponse, file);
  return true;
}
jodd.htmlstaplerHtmlStaplerBundlesManagerlookupBundleFile

Javadoc

Lookups for bundle file.

Popular methods of HtmlStaplerBundlesManager

  • <init>
    Creates new instance and initialize it.
  • createDigest
    Creates digest i.e. bundle id from given string. Returned digest must be filename safe, for all plat
  • fixCssRelativeUrls
    Returns the content with all relative URLs fixed.
  • createBundle
    Creates bundle file by loading resource files content. If bundle file already exist it will not be r
  • createBundleFile
    Creates bundle file in bundleFolder/staplerPath. Only file object is created, not the file content.
  • fixRelativeUrl
    For a given URL (optionally quoted), produces CSS URL where relative paths are fixed and prefixed wi
  • getStaplerPath
    Returns stapler path. It is both the file system folder name and the web folder name.
  • getStrategy
    Returns current Strategy.
  • isCssResource
    Returns true if resource is CSS, so the CSS urls can be fixed.
  • isExternalResource
    Returns true if resource link has to be downloaded. By default, if resource link starts with "http:/
  • lookupBundleId
    Lookups for a bundle id for a given action. Returns null if action still has no bundle. Returns an e
  • lookupGzipBundleFile
    Locates gzipped version of bundle file. If gzip file does not exist, it will be created.
  • lookupBundleId,
  • lookupGzipBundleFile,
  • onResourceContent,
  • registerBundle,
  • registerNewBundleId,
  • reset,
  • resolveRealActionPath,
  • start,
  • setRandomDigestChars

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • From CI to AI: The AI layer in your organization
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