Top Description Fields Constructors Methods
org.springframework.web.servlet.resource

public Class ContentVersionStrategy

extends AbstractVersionStrategy
Class Inheritance
Imports
java.io.IOException, org.springframework.core.io.Resource, org.springframework.util.DigestUtils, .FileCopyUtils

A VersionStrategy that calculates a Hex MD5 hash from the content of the resource and appends it to the file name, e.g. "styles/main-e36d2e05253c6c7085a91522ce43a0b4.css".
Authors
Brian Clozel, Rossen Stoyanchev
Since
4.1
See Also
VersionResourceResolver

Field Summary

Inherited from org.springframework.web.servlet.resource.AbstractVersionStrategy:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getResourceVersion(Resource
the resource to check
resource
)

Implements org.springframework.web.servlet.resource.VersionStrategy.getResourceVersion.

Determine the version for the given resource.

Inherited from org.springframework.web.servlet.resource.AbstractVersionStrategy:
addVersionextractVersiongetVersionPathStrategyremoveVersion

Constructor Detail

ContentVersionStrategyback to summary
public ContentVersionStrategy()

Method Detail

getResourceVersionback to summary
public String getResourceVersion(Resource resource)

Implements org.springframework.web.servlet.resource.VersionStrategy.getResourceVersion.

Doc from org.springframework.web.servlet.resource.VersionStrategy.getResourceVersion.

Determine the version for the given resource.

Parameters
resource:Resource

the resource to check

Returns:String

the version (never null)

Annotations
@Override