tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: How to set ContentType from within Filter?
Date Tue, 22 Jan 2008 00:01:45 GMT
Hash: SHA1


Eric B. wrote:
| Ahhh yes - my mistake for not being clear enough.  I had already
| that.  Or another option is to put <% response.setContentType(
"text/css" )
| %>.  However, I am looking more in the sense that I don't want Jasper
to put
| anything in my output class.

I'm not sure if that's going to happen. You could try setting it to an
empty string, but you're likely to get a blank-string Content-Type
header, then. I think the JSP compiler really wants to set a content-type.

| Basically, the issue I am running into right now is that I have CSS pages
| that have some JSP code in them.
| Consequently, they need to be compiled.


Why are you doing this?

| However, I don't want to start putting in a tag within each JSP file to
| indicate that it is a CSS page; rather I'd prefer to use a filter to
| determine that for me, and set the content type in the filter itself.

You /could/ wrap the incoming request you pass to chain.doFilter in an
HttpServletRequestFilter that ignores calls to setContentType (or
equivalent setHeader("Content-Type", ...) calls).

That way, your filter has the last word in the Content-Type argument.

- -chris
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message