Solved

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

Posted on 2003-11-11
30
340 Views
Last Modified: 2010-03-31
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.....

0
Comment
Question by:yeohhosing
  • 13
  • 7
  • 6
  • +1
30 Comments
 
LVL 92

Accepted Solution

by:
objects earned 43 total points
ID: 9720748
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.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 41 total points
ID: 9720872
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
0
 
LVL 9

Assisted Solution

by:doronb
doronb earned 41 total points
ID: 9752936
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!
0
 
LVL 92

Expert Comment

by:objects
ID: 9753006
> 1) JSP's are Servlets

yes but they only handle returning text.
0
 
LVL 9

Expert Comment

by:doronb
ID: 9757377
If I remember correctly, that's not entirely true as there are directives you can use to change that.
0
 
LVL 92

Expert Comment

by:objects
ID: 9757416
> 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.
0
 
LVL 9

Expert Comment

by:doronb
ID: 9757498
How about a <%@ page contentType="application/vnd.ms-excel" %> tag for instance?
0
 
LVL 92

Expert Comment

by:objects
ID: 9757522
I don't have a copy of the jsp spec handy, but from memory thats not valid.
0
 
LVL 9

Expert Comment

by:doronb
ID: 9757526
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 9757528
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.
0
 
LVL 9

Expert Comment

by:doronb
ID: 9757535
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 :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9758191
<%@ 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.
0
 
LVL 9

Expert Comment

by:doronb
ID: 9759950
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.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 92

Expert Comment

by:objects
ID: 9760002
> <%@ 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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9760005
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.
0
 
LVL 9

Expert Comment

by:doronb
ID: 9760010
Well, lets agree that you'd need a Servlet on the server side then? :)
0
 
LVL 9

Expert Comment

by:doronb
ID: 9760011
True CEHJ, but I don't think the author means to use FTP? :o
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9760012
>>11/16/2003 01:35PM PST
 was to doronb of course - but this is all getting a bit flakily theoretical..;
0
 
LVL 9

Expert Comment

by:doronb
ID: 9760014
LOL well, its 90% theory and 10% implementation anyway, isn't it?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9760017
A servlet could be involved - but i can't (or rather won't ;-)) think how for now
0
 
LVL 9

Expert Comment

by:doronb
ID: 9760023
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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9760032
I can't speak for anything other than IE 5.5. and it certainly doesn't support download resumption
0
 
LVL 9

Expert Comment

by:doronb
ID: 9760034
Even if IE does support download resuming, the Servlet would have to be written in accordance to IE's resume protocol...
0
 
LVL 92

Expert Comment

by:objects
ID: 9760166
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.

0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 10232810
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.
0
 
LVL 9

Expert Comment

by:doronb
ID: 11515187
What about some points for the experts? :)
0
 
LVL 9

Expert Comment

by:doronb
ID: 11645860
No objections here :)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now