类 ResourceWebHandler

  • 所有已实现的接口:
    InitializingBean, WebHandler

    public class ResourceWebHandler
    extends Object
    implements WebHandler, InitializingBean
    HttpRequestHandler that serves static resources in an optimized way according to the guidelines of Page Speed, YSlow, etc.

    The "locations" property takes a list of Spring Resource locations from which static resources are allowed to be served by this handler. Resources could be served from a classpath location, e.g. "classpath:/META-INF/public-web-resources/", allowing convenient packaging and serving of resources such as .js, .css, and others in jar files.

    This request handler may also be configured with a resourcesResolver and resourceTransformer chains to support arbitrary resolution and transformation of resources being served. By default a PathResourceResolver simply finds resources based on the configured "locations". An application can configure additional resolvers and transformers such as the VersionResourceResolver which can resolve and prepare URLs for resources with a version in the URL.

    This handler also properly evaluates the Last-Modified header (if present) so that a 304 status code will be returned as appropriate, avoiding unnecessary overhead for resources that are already cached by the client.

    从以下版本开始:
    5.0
    作者:
    Rossen Stoyanchev, Brian Clozel