Question

Do Java REST frameworks like Restlet and Jersey allow one to send a file as input to a web service?

This would encompass the client sending the file and the server then receiving and processing the file.

Was it helpful?

Solution

If you're asking if you can do an HTTP PUT to a Restlet service, then, absolutely, yes you can. You can use the Directory class if you just want to store the file, or you can implement your own ServerResource to handle the new resource.

I haven't used Jersey, but Restlet is a fantastic api.

OTHER TIPS

Well, there's no restriction for them not to do it. REST handles files without any problems. Take a look at: http://mikedesjardins.us/wordpress/2007/04/restful-services-on-ftp/

You can also use REST Assured which builds on HTTP Client. It's very simple:

given().multiPart(new File("/somedir/file.bin")).when().post("/fileUpload");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top