how can we upload/FTP a file to a specified location using doPut() method?
and is it better to use doPut() method for uploading a file rather than using some utilities from apache etc?
Thanks
Neeraj
Soumil Shah
Ranch Hand
Joined: Jul 13, 2009
Posts: 54
posted
0
I guess there is no method in the Servlet API to do this. And no modern browser uses HTTP PUT for anything meaningful, so doPut() should not be used [this is what my understanding]. So i guess using apache libraries could be the good. [package org.apache.commons.upload]
I guess there is no method in the Servlet API to do this.
There is. You can get the input stream and stream the file. The commons upload utility allows you to stream the file AND read some parameters when you do a multipart request.
BTW, I think many web servers are configured not to accept PUT and DELETE Http Requests, So I think it is better to stick to POST,
If its your server and looking for good amounts of file transfers, I guess you can consider using a FTP Server/client combination instead...
BTW, I think many web servers are configured not to accept PUT and DELETE Http Requests
Does this claim have a source ? Most web servers should support the request, but probably, no one will every use them. Unless you are working with Atom publishing protocol or something like that.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
I think many web servers are configured not to accept PUT and DELETE Http Requests
Most web servers should support the request, but probably, no one will every use them. Unless you are working with Atom publishing protocol or something like that.
... or RESTful web services, which make extensive use of the less common HTTP methods, and are becoming ever more popular.
Neeraj Vij
Ranch Hand
Joined: Nov 25, 2003
Posts: 315
posted
0
Hi,
I am going through a source code, where a servlet is written to process doPut Request. it is saving the file uploaded as .csv file using stream. I am not sure how that servlet is getting invoked if it can't be invoked through a browser.
can it be done through some web proxy servers by modifying the http methods?
I am not sure if it's file upload or it's supporting FTP.
Any inputs will be a great help.
Thanks
Neeraj.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35237
7
posted
0
Servlets do not support FTP, and proxies had better not modify any request as fundamentally as changing the method.
Even though HTML forms do not support PUT, there's no difficulty in writing a client that does - the Apache HttpClient library is an example of that.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.