• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Signed applet download

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone. As this is my first time doing applet. Please be patient with me.

I'm in the process of building a JSP project that allows a JAR file to be downloaded from server to client. Inside this applet, it will state the path on where to download the file to.

I hope this doesn't sound too much..

Does anyone have some kind of example of this applet which i can learn from? The examples that I've found does not allow me to looked into their contents.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What features does an applet add to the download process that a simple HTML link wouldn't?
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf. I was told that I'll need to use a signed applet in order to access the client file system.

In this case, I'll need the downloaded file to be placed in another folder without the user choosing the place to download to.

I've tried looking for applet file download. I've managed to find some which is trial programs but I'm not able to modify them.
[ October 01, 2007: Message edited by: Adrian Lee ]
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, OK. Downloading the contents of a file isn't hard. The following code provides you with an InputStream, the contents of which you can save to the local file.


Signing an applet is discussed in HowCanAnAppletReadFilesOnTheLocalFileSystem
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf for your help.
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again guys. Sorry, I don't quite understand on how I'm able to do this.

And there's some things I'll need to clarify.

Since the JAR file which is supposed to be downloaded to the client system is stored in eg. (d:/download).

1) Does it mean that I need to make the file into DataOutputStream?
2) Is it similiar to socket programming which I'll need to open a socket in order for the file download to start?

Thanks in advance
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


1) Does it mean that I need to make the file into DataOutputStream?


A FileOutputStream is called for here.


2) Is it similiar to socket programming which I'll need to open a socket in order for the file download to start?


No. Those two lines I posted earlier accomplish the download. You need to add code that reads bytes from the InputStream and writes them to the FileOutputStream (which is hooked up to a File).

Here's some code which copies data from in InputStream to an OutputStream that you can adapt.
[ October 02, 2007: Message edited by: Ulf Dittmer ]
 
Adrian Lee
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf, Thanks for being very helpful!
 
Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic