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; }
source share