Class AbstractVersionStrategy.PrefixVersionPathStrategy
java.lang.Object
org.springframework.web.servlet.resource.AbstractVersionStrategy.PrefixVersionPathStrategy
- All Implemented Interfaces:
VersionPathStrategy
- Enclosing class:
- AbstractVersionStrategy
protected static class AbstractVersionStrategy.PrefixVersionPathStrategy
extends Object
implements VersionPathStrategy
A prefix-based
VersionPathStrategy
,
for example, "{version}/path/foo.js"
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddVersion
(String path, String version) Add a version to the given request path.extractVersion
(String requestPath) Extract the resource version from the request path.removeVersion
(String requestPath, String version) Remove the version from the request path.
-
Constructor Details
-
PrefixVersionPathStrategy
-
-
Method Details
-
extractVersion
Description copied from interface:VersionPathStrategy
Extract the resource version from the request path.- Specified by:
extractVersion
in interfaceVersionPathStrategy
- Parameters:
requestPath
- the request path to check- Returns:
- the version string or
null
if none was found
-
removeVersion
Description copied from interface:VersionPathStrategy
Remove the version from the request path. It is assumed that the given version was extracted viaVersionPathStrategy.extractVersion(String)
.- Specified by:
removeVersion
in interfaceVersionPathStrategy
- Parameters:
requestPath
- the request path of the resource being resolvedversion
- the version obtained fromVersionPathStrategy.extractVersion(String)
- Returns:
- the request path with the version removed
-
addVersion
Description copied from interface:VersionPathStrategy
Add a version to the given request path.- Specified by:
addVersion
in interfaceVersionPathStrategy
- Parameters:
path
- the requestPathversion
- the version- Returns:
- the requestPath updated with a version string
-