Hi, I want to track the users' requesting a static resource from my application. For example, I would like to track(log) when the user downloads an mp3 song(for example). Now for this, I wrote some code in my already existing filter. Everything works fine,when the user clicks an mp3 song(static resource, it does not goto my servlet), the code in my filter is getting executed and the user is presented a download/save page. But the problem arises when the user clicks "cancel" button instead of saving the song. When he does this, at the server I get this exception java.net.SocketException: Connection reset by peer: socket write error. I understand that when the user clicks "cancel", the response is somewhat in an incomplete state right??? Prior to this , The DefaultServlet was serving my static resources. Now when I changed my web.xml to make all the request(including static) to pass through my filter, I get this problem. What am I missing here, how do I know if the user has requested a static resource or a servlet request? The above design was working fine but for the problem described? Any help? Thanx shankar.
i found out that this exception occurs when the client has closed the connection which exactly is happening when I click the "cancel" button instead of downloading the song. But then how did the DefaultServlet handle this situation? Shankar.
What App/Web server are you using? In my opinion, the container should clean that up for you. I have run into that in some implementations, namely Sybase's EAServer. I believe they no longer log the error (they never threw an exception that I was aware of), so it's not noticable anymore.
Originally posted by Kenneth Robinson: What App/Web server are you using? In my opinion, the container should clean that up for you. I have run into that in some implementations, namely Sybase's EAServer. I believe they no longer log the error (they never threw an exception that I was aware of), so it's not noticable anymore.
I am using tomcat. Yes maybe the DefaultServlet too threw an exception and it was caught/ignored by the tomcat container. But now I have this filter in between that is causing the problem. Since I call the method filterChain.doFilter(), it must be calling the DefaultServlet and the exception is being thrown to my code. And then I have my own ways of handling exception..... So, do you think, I should hack my code to catch and ignore this exception?? I can do this, but I was thinking if there is a better design.... Well, my requirement was very simple. Just to keep track of the user downloading some mp3 songs i.e. some static resource, and I never knew this is not so simple as it might seem at the surface.... Shankar.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop