Class ContentVersionStrategy
- java.lang.Object
- org.springframework.web.servlet.resource.AbstractVersionStrategy
- org.springframework.web.servlet.resource.ContentVersionStrategy
- All Implemented Interfaces:
VersionPathStrategy
,VersionStrategy
public class ContentVersionStrategy extends AbstractVersionStrategy
AVersionStrategy
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"
.- Since:
- 4.1
- Author:
- Brian Clozel, Rossen Stoyanchev
- See Also:
VersionResourceResolver
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.web.servlet.resource.AbstractVersionStrategy
AbstractVersionStrategy.FileNameVersionPathStrategy, AbstractVersionStrategy.PrefixVersionPathStrategy
Field Summary
Fields inherited from class org.springframework.web.servlet.resource.AbstractVersionStrategy
logger
Constructor Summary
Constructors Constructor Description ContentVersionStrategy()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getResourceVersion(Resource resource)
Determine the version for the given resource.Methods inherited from class org.springframework.web.servlet.resource.AbstractVersionStrategy
addVersion, extractVersion, getVersionPathStrategy, removeVersion
Constructor Detail
ContentVersionStrategy
public ContentVersionStrategy()
Method Detail
getResourceVersion
public String getResourceVersion(Resource resource)
Description copied from interface:VersionStrategy
Determine the version for the given resource.- Parameters:
resource
- the resource to check- Returns:
- the version (never
null
)