posted 15 years ago
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