/** * Calculates the MD5 hash of the string. * * @param text * @return md5 hash of the string */ public static String getHashMD5(String text) { byte[] bytes = text.getBytes(StandardCharsets.ISO_8859_1); return getHashMD5(bytes); }
@Override protected String getResourceVersion(String resourcePath) { String artifactPath = resourcePath.substring(0, resourcePath.indexOf('/') + 1); if (pathAliases.containsKey(artifactPath)) { String artifactVersion = pathAliases.get(artifactPath); // Do not replace already fixed-version paths. // i.e. skip replacing first path segment of "/jquery/1.11.1/jquery.min.js" // BUT do replace first path segment of "jquery/jquery.min.js". if (!resourcePath.startsWith(artifactVersion)) { return CryptoUtils.getHashMD5(artifactVersion); } } return null; }