• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File upload and download use SSL?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

We have a web application using SSL. But this web application provides uploading file from client to web server and downloading file from web server to client. Will file upload and file download use SSL?

Thanks for your assistance in advance.

Calson
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should work just fine if you use an "https:" URL instead of an "http:" URL. Did you encounter any problems?
 
Calson LI
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your response, ULF.

Actually, there are 2 ways of uploading file to web server in a web application using 'https'.

Method 1. In doGet() of doPost() method, write code like the following
public void doGet(... req, ... res) {
res.setContentType("application/jar");
File f = new File("test.jar");
byte [] byteArray = new byte[(int) f.length()];
FileInputStream is = new FileInputStream(f);
is.read(byteArray);
OutputStream os = res.getOutputStream();
os.write(byteArray);
os.flush();
}

Method 2. Use 3rd party jar to upload file to web server.

To my understanding Method 1 should use SSL channel, i.e. https. Am I right?

But for Method 2, if we use https, will method 2 use this secure channel to send data from client to web server?

Thank you,
Calson
 
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
I'm a bit confused. Both methods seem to do the same, only that method 1 is coded by you, while method 2 is coded by the developers of a 3rd party library. Of course, method 1 looks like it facilitates the download of a file, not an upload, so no URL would need to be specified.
 
Calson LI
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,

Thanks a lot for your reply. Yes, you are right, method 1 is downloading. I am more worrying about method 2.

Regards,
Calson
 
reply
    Bookmark Topic Watch Topic
  • New Topic