Package org.springframework.web.servlet.resource

# Class FixedVersionStrategy

java.lang.Object
org.springframework.web.servlet.resource.AbstractVersionStrategy
org.springframework.web.servlet.resource.FixedVersionStrategy

All Implemented Interfaces:
  `VersionPathStrategy`, `VersionStrategy`

public class FixedVersionStrategy extends AbstractVersionStrategy
A `VersionStrategy` that relies on a fixed version applied as a request path prefix, for example, reduced SHA, version name, release date, etc.

This is useful for example when `ContentVersionStrategy` cannot be used such as when using JavaScript module loaders which are in charge of loading the JavaScript resources and need to know their relative paths.

Since:
  4.1
Author:
  Brian Clozel, Rossen Stoyanchev
See Also:
  - `VersionResourceResolver`

## Nested Class Summary

## Nested classes/interfaces inherited from class org.springframework.web.servlet.resource.AbstractVersionStrategy

`AbstractVersionStrategy.FileNameVersionPathStrategy, AbstractVersionStrategy.PrefixVersionPathStrategy`

## Field Summary

### Fields inherited from class org.springframework.web.servlet.resource.AbstractVersionStrategy

`logger`

## Constructor Summary

Constructors
Constructor
Description
`FixedVersionStrategy(String version)`
Create a new FixedVersionStrategy with the given version string.

## Method Summary

Modifier and Type
Method
Description
`String`
`getResourceVersion(org.springframework.core.io.Resource resource)`
Determine the version for the given resource.

### Methods inherited from class org.springframework.web.servlet.resource.AbstractVersionStrategy

`addVersion, extractVersion, getVersionPathStrategy, removeVersion`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### FixedVersionStrategy

public FixedVersionStrategy(String version)
Create a new FixedVersionStrategy with the given version string.

Parameters:
  `version` - the fixed version string to use

## Method Details

### getResourceVersion

public String getResourceVersion(org.springframework.core.io.Resource resource)
Description copied from interface: `VersionStrategy`
Determine the version for the given resource.

Parameters:
  `resource` - the resource to check
Returns:
  the version (never `null`)