This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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 ]
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.