Jetty allows headers to be set using the jetty-rewrite functionality, but it doesn't appear to be very smart, and only accepts a fixed string.
How do I tell Jetty to send an "expires in 8 hours" header?
With Apache .htaccess and mod_expires you can do "access plus 8 hours" but of course Jetty doesn't understand .htaccess files, nor can I find any info on a similar construct in jetty-rewrite.xml
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
<Set name="pattern">*.png</Set>
<Set name="name">Expires</Set>
<Set name="value">access plus 8 hours</Set>
</New>
</Arg>
</Call>
That just sends the literal text "access plus 1 day" back, which is of course ignored by the client.
Could/should this be done with a servlet filter? Jetty has a Gzip filter but doesn't appear to offer something similar for dynamically setting headers.