spring-framework / org.springframework.web.servlet.resource / AbstractVersionStrategy

AbstractVersionStrategy

abstract class AbstractVersionStrategy : VersionStrategy

Abstract base class for VersionStrategy implementations.

Supports versions as:

Note: This base class does not provide support for generating the version string.

Author
Brian Clozel

Author
Rossen Stoyanchev

Since
4.1

Functions

addVersion

open fun addVersion(requestPath: String, version: String): String

extractVersion

open fun extractVersion(requestPath: String): String

getVersionPathStrategy

open fun getVersionPathStrategy(): VersionPathStrategy

removeVersion

open fun removeVersion(requestPath: String, version: String): String

Inheritors

ContentVersionStrategy

open class ContentVersionStrategy : AbstractVersionStrategy

A VersionStrategy that calculates an Hex MD5 hashes from the content of the resource and appends it to the file name, e.g. "styles/main-e36d2e05253c6c7085a91522ce43a0b4.css".

FixedVersionStrategy

open class FixedVersionStrategy : AbstractVersionStrategy

A VersionStrategy that relies on a fixed version applied as a request path prefix, e.g. reduced SHA, version name, release date, etc.

This is useful for example when ContentVersionStrategy cannot be used such as when using JavaScript module loaders which are in charge of loading the JavaScript resources and need to know their relative paths.