I have read in the spec and tried a filter myself, and I have a few questions:
1. Where the spec(pg 45) says: "Only one instance per filter declaration in the deployment descriptor is instantiated per Java virtual machine of the container." I read this as it works similar to a servlet, one instance per virtual host(not jvm) with many threads. Is this correct? 2. I have a filter on a downloadable file(50MB) and I have noticed that when the user clicks 'cancel' on the browser, that it throws an IOException, which I can trap in my filter ['try' around doChain()]. If I rethrow this exception(after my processing), it is like I never touched it and it writes an error in the log about 'socket write error'. If I do not rethrow this exception is there any processing or cleanup, that will not get done correctly? Or can I just return without rethrowing? I would really like to cut down on the 'socket write errors' in the logs. 3. How can I check the status(200,404,etc) on the response object after the doChain() has returned? I don't need to wrap the request/response, I am just interested in knowing when a 404 occurs(only within this filter if possible). I tried converting it to a HttpServletResponse object, but I don't see how to *read* the status. 4. How much more efficient is handling a request in filter than handling it in a servlet if the handling code is the same. I noticed that when I converted the ServletRequest to an HttpServletRequest that not all the functions were available(getPathInfo() was the one that I noticed), so I assume that there is some processing going on between the filter and the servlet - but I could be wrong. I'm really liking these filters since I share servlets between virtual hosts, and now I see that filters can really help cleanup the customized processing in my servlets for each virtual host. Charlie -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
