Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-7116

Add ResourceHttpRequestHandler for efficiently serving static resouces


    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.0.4
    • Component/s: Web
    • Labels:
    • Last commented by a User:


      The Spring JavaScript module of the Web Flow project contains a ResourceServlet that efficently serves static resources such as .css and .js files. This servlet has proven generally useful and, as a user, I'd like this functionality available in Spring Framework's core web support. Specifically:

      • I'd like this functionality to be configurable within a Spring MVC DispatcherServlet, without requiring another servlet to be configured in web.xml. This simplifies setup and also allows for greater configuration control with the Spring MVC namespace.
      • Caching should be aggressive. All resources served up should be cached with a far out expiration date (e.g. 1 year).
      • Compression should be applied to text-based resources e.g. .css, .js, .json, and .xml files (should be possible to disable)
      • Minification should be applied to text-based resources where possible e.g. .js (should be possible to disable)
      • Resource bundling should be supported. This provides the ability to load multiple resources in one HTTP request, which can improve performance.
      • Resource versioning should be supported. This causes clients to refresh cached resources when a new version of the application is deployed. This prevents clients from working with stale content after deployment of a new version. (should be possible to disable, when disabled no caching should be performed)
      • It should be possible to serve resources out of the webapp root as well as jar file bundles.
      • The ResourceHandler should aim to be compatible with JSF 2.0 resource handling as far as possible (we should not make compromises but we shouldn't be different when we can align).

      The ResourceHandler should also be capable of being the "default handler" for the DispatcherServlet. This would provide a static resource handling fallback similar to how the Servlet Container works.


          Issue Links



              • Assignee:
                juergen.hoeller Juergen Hoeller
                kdonald Keith Donald
                Last updater:
                Trevor Marshall
              • Votes:
                9 Vote for this issue
                16 Start watching this issue


                • Created:
                  Days since last comment:
                  7 years, 47 weeks ago