Filter non-existing static resource locations

Same as a2c52a97ba, on the WebFlux side.

See gh-27538
This commit is contained in:
Rossen Stoyanchev
2021-10-13 14:37:03 +01:00
parent 0436dd04bf
commit 4dac8339ff
3 changed files with 52 additions and 21 deletions

View File

@@ -189,6 +189,9 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
* locations provided via {@link #setLocations(List) setLocations}.
* <p>Note that the returned list is fully initialized only after
* initialization via {@link #afterPropertiesSet()}.
* <p><strong>Note:</strong> As of 5.3.11 the list of locations is filtered
* to exclude those that don't actually exist and therefore the list returned
* from this method may be a subset of all given locations.
* @see #setLocationValues
* @see #setLocations
*/
@@ -467,6 +470,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
result.addAll(this.locationResources);
result = result.stream().filter(Resource::exists).collect(Collectors.toList());
this.locationsToUse.clear();
this.locationsToUse.addAll(result);
}