you may want to look at the compression filter examples the come with tomcat.
Charlie > -----Original Message----- > From: Andreas Hucks [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 09, 2002 5:34 AM > To: [EMAIL PROTECTED] > Subject: Using filters to transform output > > > Hi, > > I have an existing PHP application I want to port to Java > servlets (I am an > experienced programmer, but new to Java servlets). It is > basically an admin > interface for managing user accounts for community sites. To > keep this as > flexible and true to a MVC-pattern as possible, I figured I'd have my > servlet generate a custom response object from a custom > request object. I > then would write filters to translate the request parameters > to my custom > request and on the way back, create the actual output from my custom > response. This way I should be able to make the same app > usable by different > clients by just throwing in another filter (required client > types at the > moment are (X)HTML, Flash/XML, and Flash/FlashRemoting). > > From what I understand, this is one of the main uses of > filters. My question > is, how do I pass the custom request/response objects between > my filters > and the servlet? I guess it involves > HttpServletResponseWrappers, but I > can't figure out how (you can overwrite getWriter() and such, > but that is of > no use to me). What I would need is to attach my result as a > generic object > to the HttpServletResponse, and have my filter retrieve it, > format it, and > write the response to the client. > > I can do the above by having my servlet output XML, and then having my > filter transform the XML to the actual output. But this seems to be > unnecessary overhead to me (unless I want to use XSLT anyway, which I > don't). > > Thanks, > Andreas > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
