Servlets 如何读取HttpServletRequest的主体,其中请求头内容类型为application/x-www-form-urlencoded in java
我的Servlets 如何读取HttpServletRequest的主体,其中请求头内容类型为application/x-www-form-urlencoded in java,servlets,Servlets,我的HTTPServletRequest包含以下信息 headers: Accept-Encoding: gzip, deflate X-Chargify-Webhook-Signature: b048ad28f573829f52f05208aa522a6f X-Chargify-Webhook-Id: "8233897" Content-Type: application/x-www-form-urlencoded Accept: "*/*; q=0.5, applica
HTTPServletRequest
包含以下信息
headers:
Accept-Encoding: gzip, deflate
X-Chargify-Webhook-Signature: b048ad28f573829f52f05208aa522a6f
X-Chargify-Webhook-Id: "8233897"
Content-Type: application/x-www-form-urlencoded
Accept: "*/*; q=0.5, application/xml"
Content-Length: "47"
body: payload[chargify]=testing&id=8233897&event=test
现在,如何从请求中读取主体并将主体分成键/值对 Servlet服务()中的方法具有HttPServlerRequest
对象
通过使用此请求对象调用Request.getParameter(paramName)
,您可以从请求对象获取值
使用request.getParameterMap()获取了所有密钥,并进行了一些迭代以记录密钥和值