开发者

How do I send an Object and a file in a single HTTP request in java?

开发者 https://www.devze.com 2023-02-14 20:42 出处:网络
I need to send a java object and a file via HTTP in a single HTTP request. I am facing following issue:

I need to send a java object and a file via HTTP in a single HTTP request. I am facing following issue:

I am using org.apache.commons.httpclient.HttpClient implementation for this and the problem is the servlet on the server side expects the multipart request as mentioned in the request and hence the Object whic开发者_如何学Goh I send as a byte[] stream gets corrupted. If I just either file or object in a single request then this works fine.


Have you tried this tutorial: http://evgenyg.wordpress.com/2010/05/01/uploading-files-multipart-post-apache/ ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号