Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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()));
}
}
}
}
```