Track completed glass fish downloads

I want to track completed downloads that my GlassFish server is serving. I could not find a 100% correct solution using servlet lifecycle listeners. Anyone have a better idea?

+4
source share
1 answer

Put a try-catch on an IOException while the file is loading. If it was thrown, then the file download failed.

eg. in the user file servlet:

 try { response.getOutputStream().write(...); // Success! } catch (IOException e) { // Fail! throw e; } 

Or in the servlet filter, which maps to the corresponding URL file mapping pattern:

 try { chain.doFilter(request, response); // Success! } catch (IOException e) { // Fail! throw e; } 
+1
source

Source: https://habr.com/ru/post/1277494/


All Articles