类 AbstractVersionStrategy
- java.lang.Object
- org.springframework.web.servlet.resource.AbstractVersionStrategy
- 所有已实现的接口:
VersionPathStrategy
,VersionStrategy
public abstract class AbstractVersionStrategy extends Object implements VersionStrategy
Abstract base class forVersionStrategy
implementations.Supports versions as:
- prefix in the request path, like "version/static/myresource.js"
- file name suffix in the request path, like "static/myresource-version.js"
Note: This base class does not provide support for generating the version string.
- 从以下版本开始:
- 4.1
- 作者:
- Brian Clozel, Rossen Stoyanchev
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static class
AbstractVersionStrategy.FileNameVersionPathStrategy
File name-basedVersionPathStrategy
, e.g.protected static class
AbstractVersionStrategy.PrefixVersionPathStrategy
A prefix-basedVersionPathStrategy
, e.g.
构造器概要
构造器 限定符 构造器 说明 protected
AbstractVersionStrategy(VersionPathStrategy pathStrategy)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String
addVersion(String requestPath, String version)
Add a version to the given request path.String
extractVersion(String requestPath)
Extract the resource version from the request path.VersionPathStrategy
getVersionPathStrategy()
String
removeVersion(String requestPath, String version)
Remove the version from the request path.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.web.servlet.resource.VersionStrategy
getResourceVersion
构造器详细资料
AbstractVersionStrategy
protected AbstractVersionStrategy(VersionPathStrategy pathStrategy)
方法详细资料
getVersionPathStrategy
public VersionPathStrategy getVersionPathStrategy()
extractVersion
@Nullable public String extractVersion(String requestPath)
从接口复制的说明:VersionPathStrategy
Extract the resource version from the request path.- 指定者:
extractVersion
在接口中VersionPathStrategy
- 参数:
requestPath
- the request path to check- 返回:
- the version string or
null
if none was found
removeVersion
public String removeVersion(String requestPath, String version)
从接口复制的说明:VersionPathStrategy
Remove the version from the request path. It is assumed that the given version was extracted viaVersionPathStrategy.extractVersion(String)
.- 指定者:
removeVersion
在接口中VersionPathStrategy
- 参数:
requestPath
- the request path of the resource being resolvedversion
- the version obtained fromVersionPathStrategy.extractVersion(String)
- 返回:
- the request path with the version removed
addVersion
public String addVersion(String requestPath, String version)
从接口复制的说明:VersionPathStrategy
Add a version to the given request path.- 指定者:
addVersion
在接口中VersionPathStrategy
- 参数:
requestPath
- the requestPathversion
- the version- 返回:
- the requestPath updated with a version string