tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cox, Charlie" <c...@cincom.com>
Subject RE: RequestDispatcher scenarios ( was RE: static url routing)
Date Mon, 09 Dec 2002 13:44:10 GMT
RequestDispatcher works the same in a servlet or a filter. You can use
forward() in a filter and not call doFilter() just like you call forward()
in your servlet followed by a return; 

The diffference is that your request will get mapped to one servlet, but it
can also be mapped to multiple filters, each of which could serve their own
purpose. In my case this allows me to use the same servlet for different
virtual hosts and have the host-specific code in a filter.

If you need to put logic around static files, you can use a filter to
contain the logic and then let the tomcat serve the file. 

Charlie

> -----Original Message-----
> From: RXZ JLo [mailto:rufoo2001@yahoo.com]
> Sent: Monday, December 09, 2002 6:21 AM
> To: Tomcat Users List
> Subject: RequestDispatcher scenarios ( was RE: static url routing)
> 
> 
> 
> --- "Craig R. McClanahan" <craigmcc@apache.org> wrote:
> > To do a redirect filter, then, you'd examine the
> > request URI to determine
> > what kind of remapping is needed, and then do a
> > RequestDispatcher.forward() call to the remapped
> > resource name.  After the
> > forward returns (which means that the actual
> > response has been created),
> > simply return instead of calling chain.doFilter() to
> > pass the request on.
> > 
> 
> I am looking for various scenarios where
> RequestDispatcher is used. When I searched the list, I
> noticed that it can be used in a Servlet too. What
> then is the difference between using it in a Filter
> and using it in servlet? Can I just use it in the
> Servlet to serve my purpose(of serving static
> content)?
> 
> Thank you
> rf.
> 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:tomcat-user-help@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message