private Asset getLocaleAsset(Locale locale, String jQueryUIPath) {

    final String prefix =
        String.format("%s/i18n/jquery.ui.datepicker-%s", jQueryUIPath, locale.getLanguage());
    final Resource withCountryExtension =
        typeCoercer.coerce(String.format("%s-%s.js", prefix, locale.getCountry()), Resource.class);

    if (withCountryExtension.exists()) {

      return assetSource.getClasspathAsset(withCountryExtension.getPath());
    }

    final Resource withLanguageExtension =
        typeCoercer.coerce(String.format("%s.js", prefix), Resource.class);

    if (withLanguageExtension.exists()) {

      return assetSource.getClasspathAsset(withLanguageExtension.getPath());
    }

    return null;
  }
Ejemplo n.º 2
0
  private String buildClientURL(Resource resource) {
    boolean requiresDigest = cache.requiresDigest(resource);

    String path = resource.getPath();

    if (requiresDigest) {
      // Resources with extensions go from foo/bar/baz.txt --> foo/bar/baz.CHECKSUM.txt

      int lastdotx = path.lastIndexOf('.');

      path = path.substring(0, lastdotx + 1) + cache.getDigest(resource) + path.substring(lastdotx);
    }

    return path;
  }