I have a Spring app and I\'m wondering the best way to serve static content. I have tried the following:
defa
There are several better ways to serve static content.
The traditional approach was to use a UrlRewriteFilter to remap URLs as follows:
web.xml:
UrlRewriteFilter
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
UrlRewriteFilter
/*
...
Spring MVC Dispatcher Servlet
/app/*
urlrewrite.xml:
/images/**
/images/$1
/scripts/**
/scripts/$1
/styles/**
/styles/$1
/**
/app/$1
This approach can be seen in the most of Spring samples.
DispatcherServlet. It can be configured using element in Spring's config file. In Spring 3.0.4 it was extended with support of multiple location and cache control options, see 15.12.4 mvc:resources.