Introduce optimizeLocations flag for resource location filtering on startup
This flag is off by default since it requires jar files with directory entries. Closes gh-27624
This commit is contained in:
@@ -4170,8 +4170,8 @@ the example:
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/resources/**")
|
||||
.addResourceLocations("/public", "classpath:/static/")
|
||||
.setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS));
|
||||
.addResourceLocations("/public", "classpath:/static/")
|
||||
.setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4259,6 +4259,9 @@ re-write URLs to include the version of the jar and can also match against incom
|
||||
without versions -- for example, from `/jquery/jquery.min.js` to
|
||||
`/jquery/1.2.0/jquery.min.js`.
|
||||
|
||||
TIP: The Java configuration based on `ResourceHandlerRegistry` provides further options
|
||||
for fine-grained control, e.g. last-modified behavior and optimized resource resolution.
|
||||
|
||||
|
||||
|
||||
[[webflux-config-path-matching]]
|
||||
|
||||
@@ -5738,8 +5738,8 @@ The following listing shows how to do so with Java configuration:
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/resources/**")
|
||||
.addResourceLocations("/public", "classpath:/static/")
|
||||
.setCacheControl(CacheControl.maxAge(Duration.ofDays(365)));
|
||||
.addResourceLocations("/public", "classpath:/static/")
|
||||
.setCacheControl(CacheControl.maxAge(Duration.ofDays(365)));
|
||||
}
|
||||
}
|
||||
----
|
||||
@@ -5846,6 +5846,9 @@ re-write URLs to include the version of the jar and can also match against incom
|
||||
without versions -- for example, from `/jquery/jquery.min.js` to
|
||||
`/jquery/1.2.0/jquery.min.js`.
|
||||
|
||||
TIP: The Java configuration based on `ResourceHandlerRegistry` provides further options
|
||||
for fine-grained control, e.g. last-modified behavior and optimized resource resolution.
|
||||
|
||||
|
||||
|
||||
[[mvc-default-servlet-handler]]
|
||||
|
||||
Reference in New Issue
Block a user