--- Guido Schoepp <[EMAIL PROTECTED]> wrote:

> 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
>      java.io.InputStream data =
>          new java.io.FileInputStream("file.bin");
>      byte[] buf = new byte[4 * 1024];
>      int len;
>      while ((len = data.read(buf, 0, buf.length)) !=
> -1) {
>          sout.write(buf, 0, len);
>      }
> 
> After that you can forward to the desired page:
>      RequestDispatcher dispatcher =
>         
> getServletContext().getRequestDispatcher("fwd.jsp");
>      dispatcher.forward(request, response);
> 
> 
> Guido

This is one of those issues that just can't be solved
with simple HTTP and HTML.  There isn't a response
sent to the server to tell it every single download
was successful (or at least not sent back to the web
application ... TCP makes sure the last bytes get to
the other side successfully or an error occurs, but
the applications on the server side can't tell this or
at least I don't know how).  Then to make the
situation more difficult there is no defined event for
tying into the HTTP process for when a certain
download has occurred successfully.  So, one has to
use a download manager of some kind to more easily
manage things like this.  This could be a signed java
applet or shockwave file or a COM object (not cross
platform so I wouldn't recommend that, but you might
think it's ok if you force IE and windows).  One could
more easily tell if an upload had finished because you
at least have a defined form element you can access
through DOM, get the name, and then monitor the upload
progress.

Wade

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to