Reputation: 1173
I'm using RichFaces and I'm having problems with the fileUpload flash component + IE + SSL. According to research I've done, I need to change "Pragma" and "Cache-Control" HTTP headers.
How can I change those headers only for flash content?
I tried using a Servlet Filter. This is the doFilter()
method:
chain.doFilter(request, response);
HttpServletResponse resp = (HttpServletResponse) response;
if (resp.getContentType() != null && resp.getContentType().contains("flash")) { // application/x-shockwave-flash
resp.setHeader("Pragma", "");
}
The filter is being executed, the header is being changed, but then I check with firebug, the header is back to "no-cache". This is the last filter I have in my web.xml
but it is happening like if some other filter was putting the header back.
I'm also using JBoss 5. How can I solve this? Thanks.
Upvotes: 0
Views: 1592
Reputation: 7807
Try to execute the instructions to set the header before the doFilter()
. In this way:
HttpServletResponse resp = (HttpServletResponse) response;
if ( // .. your test ) {
resp.setHeader("Pragma", "");
}
chain.doFilter(request, response);
Because you cannot set an header field once the server starts sending data to the client.
Naturally in this way you have to find another method to check the contentType of the requested resources. Maybe you can do your check based on the HttpServletRequest.getRequestURI() and the filename extension in this value.
Upvotes: 1