Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bit-ranger/http-multipart
解析http multipart/form-data
https://github.com/bit-ranger/http-multipart
Last synced: about 1 month ago
JSON representation
解析http multipart/form-data
- Host: GitHub
- URL: https://github.com/bit-ranger/http-multipart
- Owner: bit-ranger
- License: gpl-2.0
- Created: 2014-08-24T14:59:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-10-29T06:07:45.000Z (about 5 years ago)
- Last Synced: 2024-03-28T20:52:43.446Z (9 months ago)
- Language: Java
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
multipart
==========将multipart/form-data解析为可以单独使用的Item
用户将得到一个列表,列表中存放解析后的对象。
### 用法示例:
```java
public class Helloweb extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
List parts = new Upload().parseRequest(request);
for (Part part : parts) {
System.out.print(part.getField());
System.out.print("--");
if(part.isFormField()) {
System.out.println(part.getValue());
}else{
System.out.println(part.getFileName());
part.write(new File("/home/sllx/tmp/" + part.getFileName()));
}
}
}
}
```