문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top