tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric B." <>
Subject Re: How to set ContentType from within Filter?
Date Mon, 21 Jan 2008 22:08:03 GMT
"Christopher Schultz" <> wrote in message
> Eric B. wrote:
> | After further debugging, I noticed that my compiled JSP class file has a
> | response.setContentType( "text/html" ) as pretty much the first
> functional
> | line in the _jspService() method.  I checked my jsp file and don't
> have that
> | anywhere...  is this something that Jasper adds in automatically?
> Yes.
> | Is there a way to avoid it?
> Yes:
> <%@page contentType="text/css" %>

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.

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. 
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.

However, as I have come to determine, Jasper will automatically insert a 
content type in the file if I don't have one otherwise specified.  What I am 
looking for is to prevent Jasper from doing that, and for me to do it myself 
in my filter.

Is there anyway to control Jasper like that?



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

View raw message