CacheHeaders: Use containsHeader instead of getHeader

The latter doesn't exist in the servlet API prior to 3.0, which we
sadly still need to support. We lose the ability to inspect the value
of the Pragma header, but in practice we never set this without
setting one of the other cache-related headers.

Change-Id: Ica34ede564fd38432e71284e6db233d200dc8a4a
This commit is contained in:
Dave Borowitz 2015-11-09 18:15:35 -05:00
parent ba69835964
commit 8084912800

View File

@ -129,9 +129,8 @@ public class CacheHeaders {
}
public static boolean hasCacheHeader(HttpServletResponse res) {
return res.getHeader("Cache-Control") != null
|| res.getHeader("Expires") != null
|| "no-cache".equals(res.getHeader("Pragma"));
return res.containsHeader("Cache-Control")
|| res.containsHeader("Expires");
}
private static void cache(HttpServletResponse res,