Top Description Methods
org.springframework.web.reactive.resource

public Interface VersionStrategy

Known Direct Implementers
org.springframework.web.reactive.resource.AbstractFileNameVersionStrategy, org.springframework.web.reactive.resource.AbstractPrefixVersionStrategy
Imports
reactor.core.publisher.Mono, org.springframework.core.io.Resource, org.springframework.lang.Nullable

A strategy to determine the version of a static resource and to apply and/or extract it from the URL path.
Authors
Rossen Stoyanchev, Brian Clozel
Since
5.0
See Also
VersionResourceResolver

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the requestPath updated with a version string
addVersion
(String
the requestPath
requestPath
,
String
the version
version
)

Add a version to the given request path.

public String

Returns:

the version string or null if none was found
extractVersion
(String
the request path to check
requestPath
)

Extract the resource version from the request path.

public Mono<String>

Returns:

the resource version
getResourceVersion
(Resource
the resource to check
resource
)

Determine the version for the given resource.

public String

Returns:

the request path with the version removed
removeVersion
(String
the request path of the resource being resolved
requestPath
,
String
the version obtained from extractVersion(String)
version
)

Remove the version from the request path.

Method Detail

addVersionback to summary
public String addVersion(String requestPath, String version)

Add a version to the given request path.

Parameters
requestPath:String

the requestPath

version:String

the version

Returns:String

the requestPath updated with a version string

extractVersionback to summary
public String extractVersion(String requestPath)

Extract the resource version from the request path.

Parameters
requestPath:String

the request path to check

Returns:String

the version string or null if none was found

Annotations
@Nullable
getResourceVersionback to summary
public Mono<String> getResourceVersion(Resource resource)

Determine the version for the given resource.

Parameters
resource:Resource

the resource to check

Returns:Mono<String>

the resource version

removeVersionback to summary
public String removeVersion(String requestPath, String version)

Remove the version from the request path. It is assumed that the given version was extracted via extractVersion(String).

Parameters
requestPath:String

the request path of the resource being resolved

version:String

the version obtained from extractVersion(String)

Returns:String

the request path with the version removed