use of org.eclipse.scout.rt.platform.util.ImmutablePair in project scout.rt by eclipse.
the class HtmlDocumentParser method getScriptAndFingerprint.
/**
* Returns the external script name including a content-based fingerprint.
*/
protected Pair<HttpCacheObject, String> getScriptAndFingerprint(String internalPath) throws IOException {
ScriptFileLoader scriptLoader = createScriptFileLoader();
HttpCacheKey cacheKey = scriptLoader.createCacheKey(internalPath);
HttpCacheObject script = m_cache.get(cacheKey);
if (script == null) {
// cache miss: try to load script
script = scriptLoader.loadResource(cacheKey);
}
if (script == null) {
// script not found -> no fingerprint
LOG.warn("Failed to locate script referenced in html file '{}': {}", m_params.getHtmlPath(), internalPath);
return null;
}
String fingerprint = Long.toHexString(script.getResource().getFingerprint());
return new ImmutablePair<>(script, fingerprint);
}
use of org.eclipse.scout.rt.platform.util.ImmutablePair in project scout.rt by eclipse.
the class BinaryResourceUrlUtility method extractFilenameWithFingerprint.
public static Pair<String, Long> extractFilenameWithFingerprint(String filenameWithFingerprint) {
Matcher m = REGEX_FINGERPRINT_PATTERN.matcher(filenameWithFingerprint);
m.find();
String fingerprintString = m.group(1);
String filename = m.group(2);
Long fingerprint = 0L;
if (StringUtility.hasText(fingerprintString)) {
fingerprint = Long.valueOf(fingerprintString);
}
return new ImmutablePair<>(filename, fingerprint);
}
Aggregations