tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brendan Miller <catph...@catphive.net>
Subject how to change headers based on response code in filter
Date Sat, 01 Feb 2014 02:06:59 GMT
Currently, I have a filter that sets some cache control headers. I need to
change these cache control headers in the case of a non-successful
response, such as a 404.

Unfortunately, when I check HttpServletReponse.getStatus() in the in my
doFilter method, it always reports 200 even if actually a 404 will be sent
to the browser. I'm guessing that the response status isn't yet set at the
point filters are run.

How can I make sending this particular header conditional upon the response
code, so that I only send it in the case of a successful response?

Brendan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message