*
The moose likes Servlets and the fly likes How to download a huge file from server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to download a huge file from server" Watch "How to download a huge file from server" New topic
Author

How to download a huge file from server

Marian Kulisch
Greenhorn

Joined: Nov 30, 2005
Posts: 3
I work with Websphere. There is an JSP for downloading a huge file until 12MByte. This works fine and without using an servlet... but two problems are there:
first problem:
- during the download the server is busy with 100%
- download takes more time 20 minutes or more
- download rate is only 7 kbyte per second
- client is an internet explorer version 5xx until 6xx
- my code snippet:
PrintWriter pw = response.getWriter();
IModule module = createModule();
module.write(pw); // here only pw.write(...) init
pw.flush();
pw.close();
- other users have to wait long for their requests

second poblem:
- if an user closed the internet explorer, the server will not feel this event and do not stop sending data... until all data are send.
- if an user answer the pop up of internet explorer for downloading with "cancel", the server will be also not stop sending data... until all data are send.

How could i insert any thread support for sharing the 100% busy of server in my jsp?
How could i send an signal for stopping download in my jsp, if the user closed the internet explorer suddenly?

I can not imagine myself, that i should use servlets for providing downloads of huge files... because servlets in websphere are difficult to admin and handle.

I am not sure about this topic - jsp or websphere problem?

[Bear edit: removed shouting from title]
[ November 30, 2005: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Welcome to the Ranch, Marian.

When posting, please refrain from using all uppercase. It's considered "shouting" and is rather rude. I have changed the title to mixed case for use.

As to

because servlets in websphere are difficult to admin and handle.


How so? Does websphere require special care when deploying servlets?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I haven't found servlets to be difficult to administer in Websphere, but then I use a tool-program to generate the EAR files. If you have to install new versions of your servlets frequently it can be inconvenient, since you have to stop and start your web application, whereas you can just bung a JSP into the application and have it recompiled right away. However I work in an environment where we don't have to do frequent changes of our code, so it isn't a problem. Also, we use persistent sessions and have a script to re-install the EAR file which takes only a minute to run, so it isn't a major deal to do that. We use servlets to do the prep work and JSPs to generate the HTML, so if we were doing downloads we would use servlets to do them.

Anyway, to sort of answer the original question, I don't think it makes any practical difference whether you use a servlet or a JSP, since a JSP is a servlet anyway once it's compiled. They would both work the same way. So if you're looking for a solution, don't look in the JSP. Look in Websphere or in the web server you have between it and the Internet, if there is one, for a possible solution. I don't know what that might be, sorry.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Moved to the servlets forum.
 
jQuery in Action, 2nd edition
 
subject: How to download a huge file from server
 
Similar Threads
IBM HttpServer and websphere Appserver
Error dowloading from HTTPS page using IE6
Passing huge string to JSP..
Websphere to busy (100%) after request for downloading file
To get the details of client while sending a packet if it is closed or open?