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-basedVersionPathStrategy, e.g."{version}/path/foo.js".
Constructor Summary
Constructors Constructor Description PrefixVersionPathStrategy(String version)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddVersion(String path, String version)Add a version to the given request path.StringextractVersion(String requestPath)Extract the resource version from the request path.StringremoveVersion(String requestPath, String version)Remove the version from the request path.
Constructor Detail
PrefixVersionPathStrategy
public PrefixVersionPathStrategy(String version)
Method Detail
extractVersion
public String extractVersion(String requestPath)
Description copied from interface:VersionPathStrategyExtract the resource version from the request path.- Specified by:
extractVersionin interfaceVersionPathStrategy- Parameters:
requestPath- the request path to check- Returns:
- the version string or
nullif none was found
removeVersion
public String removeVersion(String requestPath, String version)
Description copied from interface:VersionPathStrategyRemove the version from the request path. It is assumed that the given version was extracted viaVersionPathStrategy.extractVersion(String).- Specified by:
removeVersionin 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
public String addVersion(String path, String version)
Description copied from interface:VersionPathStrategyAdd a version to the given request path.- Specified by:
addVersionin interfaceVersionPathStrategy- Parameters:
path- the requestPathversion- the version- Returns:
- the requestPath updated with a version string