小编Ale*_*kov的帖子

JSOUP + multipart/form-data响应

下午好,

通常,我需要通过JSOUP以响应multipart/form-data的形式将数据发送到站点

例如,采用sgeniriruet您的查询的简单形式.

<form action =« localhost:8000 »method =«post»enctype =«multipart/form-data»
<input type =«text»name =«text»value =«text default»
<input type =«file»name = «file1»
<input type =«file»name =«file2»
Submit </ button
</ form

通过浏览器发布回复:

>Request Headers Provisional headers are shown Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Content-Type:multipart/form-data;
boundary=----WebKitFormBoundaryjtkXVNw9YVG1H2P9 Origin:null
Upgrade-Insecure-Requests:1 User-Agent:Mozilla/5.0 (Windows NT 6.1;
WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106
Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id:8DCCE949-56FA-4AB0-81B7-DA2BC7960E5C

->Request Payload
------WebKitFormBoundaryjtkXVNw9YVG1H2P9 Content-Disposition: form-data; name=«text»

text default
------WebKitFormBoundaryjtkXVNw9YVG1H2P9 Content-Disposition: form-data; name=«file1»; filename="" Content-Type:
application/octet-stream

------WebKitFormBoundaryjtkXVNw9YVG1H2P9 Content-Disposition: form-data; name=«file2»; filename="" Content-Type:
application/octet-stream

------WebKitFormBoundaryjtkXVNw9YVG1H2P9--
Run Code Online (Sandbox Code Playgroud)

我试图创建一个类似的请求,但没有找到正确的方法,以便服务器收到请求.

我的代码:

Map<String, …
Run Code Online (Sandbox Code Playgroud)

java post multipartform-data jsoup

0
推荐指数
1
解决办法
2672
查看次数

标签 统计

java ×1

jsoup ×1

multipartform-data ×1

post ×1