users@jersey.java.net

[Jersey] Re: cache headers on a 404?

From: Sam Perman <sam_at_permans.com>
Date: Tue, 29 May 2012 11:26:23 -0400

It does look like its a jetty thing. We call Responses.notFound() which
ultimately calls HttpServletResponse.sendError() which has the side effect
of overriding the cache control header.

Jetty has a way to configure this globally for all errors (
http://jira.codehaus.org/browse/JETTY-1177 ) but we only really want to
configure this for 404

Is there a hook somewhere in jersey that would get called after we build
our response but before we relinquish control back to jetty?

thanks
sam

On Fri, May 25, 2012 at 5:30 PM, Sam Perman <sam_at_permans.com> wrote:

> We're using jetty. I'll check that log to confirm.
>
> thanks
> Sam
>
> On Friday, May 25, 2012 at 5:20 PM, Pavel Bucek wrote:
>
> I don't think this is added by Jersey, I usually tend to blame the
> container for this. Which one are you using?
>
> You can also verify this statement by adding ContainerResponse Logging
> filter and check logs for that header, see
>
> http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/container/filter/package-summary.html
>
> Regards,
> Pavel
>
> On 5/25/12 10:51 PM, Sam Perman wrote:
>
> Hi
>
> We want to be able to cache the 404 responses from our server no
> matter what cache controls we set on the response, the headers that
> are returned are always set to no cache (I think because
> reseponse.sendError ultimately resets the cache control headers)
>
> Any ideas?
>
> thanks
> sam
>
>
>