库和从输入流解析多部分/表单数据的示例 [英] Library and examples of parsing multipart/form-data from inputstream
问题描述
我发送的一种HTTP请求的响应是multipart / form-data类似于:
The response to one kind of HTTP request I send is a multipart/form-data looks something like:
--------boundary123
Content-Disposition: form-data; name="json"
Content-Type: application/json
{"some":"json"}
--------boundary123
Content-Disposition: form-data; name="bin"
Content-Type: application/octet-stream
<file data>
--------boundary123
我去过使用apache发送和接收HTTP请求,但我似乎无法找到一种简单的方法来解析上面的内容,以便轻松访问表单字段。
I've been using apache to send and receive the HTTP requests, but I can't seem to find an easy way to use it to parse the above for easy access of the form fields.
我不想重新发明轮子,所以我正在寻找一个允许我做类似的工作的库:
I would prefer not to reinvent the wheel, so I'm looking for a library that allows me to do something similar to:
MultipartEntity multipart = new MultipartEntity(inputStream);
InputStream bin = multipart.get("bin");
有什么建议吗?
推荐答案
如果您使用的是Spring MVC,请参阅 http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch16s08.html
If you are using Spring MVC, see this http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch16s08.html
这篇关于库和从输入流解析多部分/表单数据的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!