tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guido Schoepp <>
Subject Re: A way to know if file download has ended
Date Sat, 03 Jun 2006 22:55:17 GMT
Bachler, Elisabeth (Elisabeth) schrieb:
> I have an application that uses tomcat 5.0.19. At one point in my
> application, the user has the possibility to click on a certain link in
> order to download a file.
> Once the file is downloaded, I would like the application to go to a certain
> jsp page.... is there a way to configure tomcat to do such a thing? I mean,
> to redirect to a page only if the download has been successfully ended?

Maybe this can work:
Write a a servlet (or JSP) that delivers the file to your user, e.g.

     response.setContentType("application/octet-stream"); //or whatever data =
     byte[] buf = new byte[4 * 1024];
     int len;
     while ((len =, 0, buf.length)) != -1) {
         sout.write(buf, 0, len);

After that you can forward to the desired page:
     RequestDispatcher dispatcher =
     dispatcher.forward(request, response);


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message