tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: How to set ContentType from within Filter?
Date Tue, 22 Jan 2008 00:01:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric,

Eric B. wrote:
| Ahhh yes - my mistake for not being clear enough.  I had already
discovered
| 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeVMmkACgkQ9CaO5/Lv0PBfcwCgj2+3v5esbhOZdKIwruYrTx1R
5h4AoK5SPB4JBY5MYWl+5xzHMwK3BtLO
=ei4x
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message