Package com.vaadin.flow.internal
Class ResourceContentHash
java.lang.Object
com.vaadin.flow.internal.ResourceContentHash
Computes and caches content-based hashes for static resources, enabling
cache-busting by appending a version query parameter to resource URLs. The
hash changes only when file content changes, allowing aggressive browser
caching.
For internal use only. May be renamed or removed in a future release.
- Author:
- Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetContentHash(VaadinService service, String resourceUrl) Computes a truncated SHA-256 content hash for the given resource URL.
-
Method Details
-
getContentHash
Computes a truncated SHA-256 content hash for the given resource URL. Returnsnullfor external URLs (http/https), missing resources, or on any I/O error. Results are cached so that each resource is read at most once.- Parameters:
service- the Vaadin service used to load the resourceresourceUrl- the resource path to hash- Returns:
- an 8-character hex hash string, or
nullif the hash cannot be computed
-