Configurable support for static resource encodings
The new EncodedResourceResolver is a generalized version of GzipResourceResolver that can be configured to support different content codings, by "br" and "gzip". GzipResourceResolver is now deprecated. Issue: SPR-16381
This commit is contained in:
@@ -2914,6 +2914,10 @@ of resolvers and transformers (e.g. resources on Amazon S3). When serving only l
|
||||
resources the workaround is to use `ResourceUrlProvider` directly (e.g. through a custom
|
||||
tag) and block for 0 seconds.
|
||||
|
||||
Note that when using both `EncodedResourceResolver` (e.g. for serving gzipped or brotli
|
||||
encoded resources) and `VersionedResourceResolver`, they must be registered in this order.
|
||||
That ensures content based versions are always computed reliably based on the unencoded file.
|
||||
|
||||
http://www.webjars.org/documentation[WebJars] is also supported via `WebJarsResourceResolver`
|
||||
and automatically registered when `"org.webjars:webjars-locator"` is present on the
|
||||
classpath. The resolver can re-write URLs to include the version of the jar and can also
|
||||
|
||||
@@ -4549,12 +4549,16 @@ In XML, the same:
|
||||
</mvc:resources>
|
||||
----
|
||||
|
||||
You can use `ResourceUrlProvider` to rewrite URLs and apply the full chain of resolvers and
|
||||
You can then use `ResourceUrlProvider` to rewrite URLs and apply the full chain of resolvers and
|
||||
transformers -- e.g. to insert versions. The MVC config provides a `ResourceUrlProvider`
|
||||
bean so it can be injected into others. You can also make the rewrite transparent with the
|
||||
`ResourceUrlEncodingFilter` for Thymeleaf, JSPs, FreeMarker, and others with URL tags that
|
||||
rely on `HttpServletResponse#encodeURL`.
|
||||
|
||||
Note that when using both `EncodedResourceResolver` (e.g. for serving gzipped or brotli
|
||||
encoded resources) and `VersionedResourceResolver`, they must be registered in this order.
|
||||
That ensures content based versions are always computed reliably based on the unencoded file.
|
||||
|
||||
http://www.webjars.org/documentation[WebJars] is also supported via `WebJarsResourceResolver`
|
||||
and automatically registered when `"org.webjars:webjars-locator"` is present on the
|
||||
classpath. The resolver can re-write URLs to include the version of the jar and can also
|
||||
|
||||
Reference in New Issue
Block a user