using java-JSP to provide advance auto resume downding file....

hello, thanks for help me to solve my problem.

now i'm try to using JAVA-JSP to write a program to download a big size file like video clip to my PC from a server i created. as we know sometime when we try to download a video file it take us a long time to finished it but in the mid way it suddenly stop or hang up, all will gone.

so i need to wite a program so a client try to access to my server and download a video file, he/she could't loss his/her file if internet traffic is busy, it all will auto resume the point it stop exactly. just nowaday download installer all provide this features right.....

yeohhosingAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
Firstly you'll need to use a servlet and not jsp to handle downloading your file.
For this servlet to support resuming it needs to accept a parameter specifying where to restart the download from.
Your client will then need to pass where it is up to after a download failure.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CEHJCommented:
You should probably use an FTP implementation to do this - that's what FTP is for after all. You need an implementation that implements the REST command. Have a look on http://sourceforge.net/search
doronbCommented:
1) JSP's are Servlets

2) I think the problem will be the client that is doing the download, since there is no problem writing a Servlet/JSP that would monitor the Server-state of a download. I'm not too sure though about how you can cause IE for instance to continue a download from where it stopped!
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Mick BarryJava DeveloperCommented:
> 1) JSP's are Servlets

yes but they only handle returning text.
doronbCommented:
If I remember correctly, that's not entirely true as there are directives you can use to change that.
Mick BarryJava DeveloperCommented:
> as there are directives you can use to change that.

I'm not aware of any. Let me know if you have any references to them.
doronbCommented:
How about a <%@ page contentType="application/vnd.ms-excel" %> tag for instance?
Mick BarryJava DeveloperCommented:
I don't have a copy of the jsp spec handy, but from memory thats not valid.
doronbCommented:
Just found it by googling :) I bet a proper book/site would be able to tell you more but since JSP's are translated to Servlets, I think that's an issue of how the translator works more than anything.
Mick BarryJava DeveloperCommented:
You may be able to fudge some containers to return binary output from jsp, but this approach may not be portable and doesn't really offer any advantages over using a servlet.
doronbCommented:
I think there's a standard way to actually write Java code in the JSP before the content-type is set.. basically creating a JSP without any textual output other than the output generated by your Java code.  I do however like Servlets more than JSP's myself :)
CEHJCommented:
<%@ page contentType="application/vnd.ms-excel" %>

is valid.

If you get your code right on the server, you will need to get the client working with it. Resumption of downloads will require support from the browser. This is certainly possible with FTP but not necessarily with your servlet approach. The client needs to be able to specify the offset to resume downloading from.
doronbCommented:
The client doesn't need to specify the offset if the Servlet is monitoring the download close enough to know when the download stopped.  Of course, this means there should be an ACK signal for every packet that the client actually saved to file; again, this must have some sort of support on the client side.

I think this can all be done with the aid of a Java application on the client side being manipulated by a Java applet downloaded from the server.
Mick BarryJava DeveloperCommented:
> <%@ page contentType="application/vnd.ms-excel" %>
> is valid.

Depends on your definition of valid, that'll just change the response content type.
You'll need to do a bit more than that to get a jsp page returning binary data.
CEHJCommented:
Well, that is if the servlet can maintain state when the network blows up. Also, you would then be making both ends responsible for continuing the join later. With the ftp method, the servlet can forget about it until the client requests a certain offset later on.
doronbCommented:
Well, lets agree that you'd need a Servlet on the server side then? :)
doronbCommented:
True CEHJ, but I don't think the author means to use FTP? :o
CEHJCommented:
>>11/16/2003 01:35PM PST
 was to doronb of course - but this is all getting a bit flakily theoretical..;
doronbCommented:
LOL well, its 90% theory and 10% implementation anyway, isn't it?
CEHJCommented:
A servlet could be involved - but i can't (or rather won't ;-)) think how for now
doronbCommented:
I meant that a Servlet would invoke an applet which in turn could invoke some program that would do the actual download.  I just don't know how IE would behave even if you did use FTP for the downloads.
CEHJCommented:
I can't speak for anything other than IE 5.5. and it certainly doesn't support download resumption
doronbCommented:
Even if IE does support download resuming, the Servlet would have to be written in accordance to IE's resume protocol...
Mick BarryJava DeveloperCommented:
Whatever protocol is used, you need it to be supported on both the server and the client. Probably a servlet implementation on the server, and perhaps a client applet running in the browser. I've used this combination previously and it works well.

sudhakar_koundinyaCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


[paq'ed and points not refunded]


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
doronbCommented:
What about some points for the experts? :)
doronbCommented:
No objections here :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.