tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Minsu Jang" <mi...@etri.re.kr>
Subject Re: How to do filter after Servlet?
Date Mon, 01 Apr 2002 12:44:48 GMT
You have to implement a response wrapper class to do something
with response. The wrapper class is to give successors in the filter
chain a fake output stream. The original output stream should be kept
unused.
By the way, be careful to overload ServletResponseWrapper.getOutputStream()
as well as getWriter(). These two methods are correlated, and you don't know
which methods will be used by the continuing filters and servlets in the filter chain.
If you overload just one of these two, you cannot assure a consistent
behaviour out of Tomcat.

Minsu

----- Original Message ----- 
From: "Cox, Charlie" <ccox@cincom.com>
To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
Cc: <xwang@qtechservices.com>
Sent: Monday, April 01, 2002 8:51 PM
Subject: RE: How to do filter after Servlet?


> look at the sample filters, you will see a call to doChain(). This is where
> your servlet will be processed. Any code before it will be executed before
> your servlet, and code after it will be executed after your servlet
> finishes.
> 
> Charlie
> 
> > -----Original Message-----
> > From: Alvin Wang [mailto:xwang@qtechservices.com]
> > Sent: Thursday, March 28, 2002 3:07 PM
> > To: Tomcat Users List; ccox@cincom.com
> > Cc: SERVLET-INTEREST
> > Subject: RE: How to do filter after Servlet?
> > 
> > 
> > Charlie, do you mean to call doChain() in servlet? I am not sure if I
> > understand you.
> > 
> > "your code" means my filter code?
> > "put your code there" means where?
> > "you need to call doChain() first", from where? Servlet?
> > 
> > Sorry for my confusion. Thanks!
> > 
> > 
> > 
> > -----Original Message-----
> > From: Cox, Charlie [mailto:ccox@cincom.com]
> > Sent: Thursday, March 28, 2002 11:23 AM
> > To: 'Tomcat Users List'
> > Subject: RE: How to do filter after Servlet?
> > 
> > 
> > the doChain() in a filter is what calls the next filter or 
> > serlvet in the
> > chain, so if you want your code to process the servlet's 
> > result, then you
> > need to call doChain() first, then put your code there.
> > 
> > you will need a custom HttpServletResponse object if you want 
> > to view any
> > part of the response.
> > 
> > Charlie
> > 
> > > -----Original Message-----
> > > From: Alvin Wang [mailto:xwang@qtechservices.com]
> > > Sent: Wednesday, March 27, 2002 5:02 PM
> > > To: Tomcat Users List
> > > Subject: How to do filter after Servlet?
> > > Importance: High
> > >
> > >
> > > Hi! This is naive. All the examples I saw about filter are
> > > "pre-servlet"
> > > filters. So how to do a "post-servlet" filter? Do I need to setup in
> > > web.xml? Or do I need to do it in code (servlet/filter)?
> > >
> > > Can any guru give me a sample?
> > >
> > > Thanks a lot!
> > >
> > >
> > > --
> > > To unsubscribe:   
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> > Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
> >
> 
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
> 
> 
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
> 
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
Mime
View raw message