> From: "Etienne" <etienno@xxxxxxxxxxxx> > Sent: Friday, February 21, 2003 11:06 AM > Subject: RE: Servlet filter and listerner best practices
> Thanks Will, > > The filter servlet is only for logging checking and parameter init. I > would have like to learn more about (J2EE) pattern using filter and > listener servlet. Logging is pretty simple, as you simply Do Your Thing either before or after the doFilter call (or both). Here the Filter is a simple wrapper. I think they're handy for doing the parameter parsing and creating a local instance of a specific Parameter class that your code relies on. This helps loosen up the binding between your logic and the fact that it's buried in a Servlet container. Of course, you still need to pass in the Parameter, I stuff it into the Request as an attribute. > The problem about the filter servlet is that doFilter() do not throws > exception, so we must catch everything in doFilter. So that is why I was > hiding everything in back of it. It can be hard to debug that way. Well, it can throw a ServletException, which is the same as the Servlet.service() method, though service() also can throw an IOException, so you're really not losing anything. Mind I'm not saying that it can't be limiting, but it's just not that much more limiting than the normal happenings within Servlet programming. Regards, Will Hartung (willh@xxxxxxxxx) --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@xxxxxxxxxxxxxxxxxx For additional commands, e-mail: tomcat-user-help@xxxxxxxxxxxxxxxxxx
