"Christopher Schultz" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Eric,
>
> Eric B. wrote:
> | Multiple reasons, one main one primary one being that we have styles
> defined
> | on a per-user basis, stored in a database.  So rather than generate an
> | entire CSS file on the fly, this allows us to display certain
> customizations
> | to the styles without any major hassles.
>
> FWIW, I would have written a plain-old servlet to grab the user-specific
> CSS and just dump it to the output stream. Since the JSP isn't really
> needed to generate content, why complicate things with a JSP? Not that
> it really matters, but you /are/ finding yourself having to code around
> these issues...

Sure....  to be honest, I've kind of inherited some of this older code, so 
am not entirely sure what the initial theory behind it was.  Probably a 
question of making things "easier".  But none the less, it is always 
interesting to see how different people think of producing similar things.


>
> | My
> | immediate thought, however, would be to subclass the HttpServletResponse
> | class and ignore the setContentType() and equv setHeader(
> "Content-Type"...)
> | methods if they have already been set by my filter or something like
> that.
> | I'm not sure what you mean by HttpServletRequestFilter, or if you mean
> | exactly the same thing that I just described.
>
> Er, I think I meant HttpServletResponseWrapper (not ...Filter).
> HttpServlteResponse is an interface, not a class, so you can't subclass
> it. You'd have to implement the entire interface, which can be tedious.
> The HttpServletResponseWrapper is part of the servlet spec and was
> written for just this purpose: wrapping an existing request, and
> overriding just a few of the methods. All the other methods just call
> _wrappedResponse.whatever(). It's exactly what you're looking for.
>
> You'd end up doing something like this:
>
> public void doFilter(...)
> {
> ~    response.setContentType("text/html; charset=utf8");
>
> ~    chain.doFilter(request, new IgnoreContentTypeResponse(response));
> }
>
> ...and then you write the IgnoreContentTypeResponse class as a subclass
> of HttpServletResponseWrapper.
>

Ahhh - that makes more sense.  Thanks for the pointer.  Of course, as is 
always the case, I got yanked off my current project  onto something 
slightly more pressing today, but hoepfully will have some time later this 
week to test this out.

Thanks again.

Eric




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

Reply via email to