Spring servlet for serving static content?

I am wondering what Spring way to serve static files. He must support:

  • Written Using Springy!
  • Simple and reliable
  • Resume download support (e.g. range request header and Accept-Ranges, ETag, and Last-Modified headers).
  • Client side caching support (e.g. If-None-Match and If-Modified-Since request headers and HEAD requests for ETag, Last-Modified and Expires response headers
  • GZIP compression support (e.g. Accept-Encoding: gzip header)

Something like the following, but using Spring 3's idioms ...

+3
source share
1 answer

You can do @Controllerwith @RequestMapping("/static/{resourceName}and use the same logic as in BalusC Servlet

Regarding gzip, use Tomcat or Apache configuration options.

+1
source

Source: https://habr.com/ru/post/1753903/


All Articles