Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

REST Fileupload client

 
Kumar Ala
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic