Implementing a client which uploads a file through Rest
posted 6 years ago
I want to implement a client in java which can upload a file through a Restful web service,I tried online examples but most of them reies on using JSP and servlet, and I am not able to comprehend how to do the same in the rest way, the only requirement I have is client is in java(not a web application, but a desktop application) , the rest service through server would be in any technology(as simple as possible) , can anybody recommend some pointers or tutorials to do the same
RESTful calls can be made over HTTP, in fact the are in your case just straight HTTP calls (GET, POST, PUT, DELETE). So using something like HttpClient from Apache as a helper library will allow you to make calls to a server.
On the server side the service just has to respond to this HTTP request. I've found a nice way to do this is using Spring's 3.0 M3 RESTful support (which basically uses annotations to make dealing with REST requests really trivial).