Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

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.....

0
yeohhosing
Asked:
yeohhosing
  • 13
  • 7
  • 6
  • +1
3 Solutions
 
objectsCommented:
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
 
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
0
 
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!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
objectsCommented:
> 1) JSP's are Servlets

yes but they only handle returning text.
0
 
doronbCommented:
If I remember correctly, that's not entirely true as there are directives you can use to change that.
0
 
objectsCommented:
> 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
 
doronbCommented:
How about a <%@ page contentType="application/vnd.ms-excel" %> tag for instance?
0
 
objectsCommented:
I don't have a copy of the jsp spec handy, but from memory thats not valid.
0
 
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.
0
 
objectsCommented:
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
 
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 :)
0
 
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.
0
 
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.
0
 
objectsCommented:
> <%@ 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
 
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.
0
 
doronbCommented:
Well, lets agree that you'd need a Servlet on the server side then? :)
0
 
doronbCommented:
True CEHJ, but I don't think the author means to use FTP? :o
0
 
CEHJCommented:
>>11/16/2003 01:35PM PST
 was to doronb of course - but this is all getting a bit flakily theoretical..;
0
 
doronbCommented:
LOL well, its 90% theory and 10% implementation anyway, isn't it?
0
 
CEHJCommented:
A servlet could be involved - but i can't (or rather won't ;-)) think how for now
0
 
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.
0
 
CEHJCommented:
I can't speak for anything other than IE 5.5. and it certainly doesn't support download resumption
0
 
doronbCommented:
Even if IE does support download resuming, the Servlet would have to be written in accordance to IE's resume protocol...
0
 
objectsCommented:
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
 
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.
0
 
doronbCommented:
What about some points for the experts? :)
0
 
doronbCommented:
No objections here :)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 13
  • 7
  • 6
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now