• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

static resources

 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic