open class ResourceHandlerRegistration
Encapsulates information required to create a resource handler.
Author
Rossen Stoyanchev
Author
Keith Donald
Author
Brian Clozel
Since
3.1
ResourceHandlerRegistration(vararg pathPatterns: String)
Create a ResourceHandlerRegistration instance. |
open fun addResourceLocations(vararg resourceLocations: String): ResourceHandlerRegistration
Add one or more resource locations from which to serve static content. Each location must point to a valid directory. Multiple locations may be specified as a comma-separated list, and the locations will be checked for a given resource in the order specified. For example, { For org.springframework.core.io.UrlResource (e.g. files, HTTP URLs, etc) this method supports a special prefix to indicate the charset associated with the URL so that relative paths appended to it can be encoded correctly, e.g. |
|
open fun resourceChain(cacheResources: Boolean): ResourceChainRegistration open fun resourceChain(cacheResources: Boolean, cache: Cache): ResourceChainRegistration
Configure a chain of resource resolvers and transformers to use. This can be useful, for example, to apply a version strategy to resource URLs. If this method is not invoked, by default only a simple PathResourceResolver is used in order to match URL paths to resources under the configured locations. |
|
open fun setCacheControl(cacheControl: CacheControl): ResourceHandlerRegistration
Specify the org.springframework.http.CacheControl which should be used by the resource handler. Setting a custom value here will override the configuration set with |
|
open fun setCachePeriod(cachePeriod: Int): ResourceHandlerRegistration
Specify the cache period for the resources served by the resource handler, in seconds. The default is to not send any cache headers but to rely on last-modified timestamps only. Set to 0 in order to send cache headers that prevent caching, or to a positive number of seconds to send cache headers with the given max-age value. |