我正在尝试从原始 HTTP 请求消息(如下所示)中提取一些信息并将它们存储到org.apache.http.message.BasicHttpRequest的实例中(https://hc.apache.org/httpcomponents-core- ga/httpcore/apidocs/index.html)类。
我能够使用org.apache.http.message.BasicLineParser类及其方法parseHeader(String value, LineParser parser)来处理(解析+存储)标头,但我不知道如何处理传递的参数表格。
POST https://gist.github.com:443/gists HTTP/1.1
Host: gist.github.com
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,fr;q=0.8,it-it;q=0.6,it;q=0.4,en-us;q=0.2
Accept-Encoding: gzip, deflate
DNT: 1
Referer: https://gist.github.com/
Connection: keep-alive
Content-Type: multipart/form-data; boundary=-------------------------10314229756379422411656878663
Content-Length: 1242
-----------------------------10314229756379422411656878663
Content-Disposition: form-data; name="parameter_name"
parameter_value
你知道一个实用程序可以解析从上面的标题之后开始的内容(即在第一个空行之后)吗?我有兴趣收集的是请求正文中存在的所有对 <"parameter_name","parameter_value"> 。
我已经阅读过类似的答案/问题,例如Parsing raw HTTP Request但我没有发现对表单数据组件有任何帮助
提前感谢您的帮助和时间