Is it possible to configure embedded Jetty (v9) to set specific headers for specific resource file types only.
At the moment, I'm not doing anything special to handle static resources, so presumably Jetty has some default handler setup to do that. Is it possible to extend or overload that default handler with some custom setup so that I can set the Cache-Control
header for html
files only?
I'm trying to accomplish something analogous to the following bit of Apache config:
<Files "*.html">
Header set Cache-Control "public, max-age=900"
</Files>
...in my Jetty setup:
public static void main(String[] args) throws Exception {
Server server = new Server(443);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("war");
server.setHandler(webapp);
...
...
}
Actually, if this can be accomplished in jetty.xml or some other configuration file, that would be preferable.