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; }