wood burning stoves 2.0*
The moose likes Web Services and the fly likes REST Fileupload client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "REST Fileupload client" Watch "REST Fileupload client" New topic
Author

REST Fileupload client

Kumar Ala
Ranch Hand

Joined: Apr 30, 2009
Posts: 53
I am new to REST implementation and i am trying to do fileupload using REST
I am trying to use Jersey(But i am okay to any API)
I would like to know some info regarding
1) Creation of client for uploading file (Finding hard time for how i can pass the file/path as a parameter ).
2) Is there anyway i can use secure upload like openSSL(If not any secure way to upload file)
Any hlp is appreciated


kumar
SCEA5 P1
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Do you want to implement capability for a REST server to accept file uploads? If so, have you had a look at Apache Commons File Upload?
http://commons.apache.org/fileupload/

Here is a slightly old article that shows examples on how to implement a client using Apache HttpClient to upload files etc:
http://www.theserverside.com/tt/articles/article.tss?l=HttpClient_FileUpload
Best wishes!
Kumar Ala
Ranch Hand

Joined: Apr 30, 2009
Posts: 53
Hi Ivan,

Thanks for the reply.
I am using struts2 for file upload through html page (Manual upload). Anyway inside struts2 it uses commonsupload . I am trying to use the same services for automatic uploads from clients. That is the reason i am looking for something like REST style client that will upload file automatically from any client securely.
I am not sure that i can chose REST in this case or i have to look for SOAP based webservices.
I have looked in to HTTPClient from commons that seems to be for the serverside rather than client side automatic secure file upload.
any help is appreaciated

Thanks
Ala
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Yes, as far as I understand, you can use a RESTful web service and Apache HTTPClient is a HTTP client, for client side applications.
If you want to upload to a RESTful web service, then it should just be a matter of doing a regular HTTP upload to a special URI.
Lets say that you have a RESTful web service allowing you to store and retrieve song files. The URL to a resource may be http://myserver.com/songservice/songs/1234
The resource in this case is a song file. If you, using for instance Apache HTTPClient, POST to that URL and the data is the song file, then a new song resource is created in the service with the uploaded song.
Hope this makes things more clear!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: REST Fileupload client
 
Similar Threads
Using FileUpload provided by Jakarta Common
Using Apache Commons Codec
Fastest way of uploading large files into the server location.
File upload to server: suggestion required
File Upload Tool