HttpServletRequest.getParameter不起作用

时间:2019-06-10 19:37:04

标签: angularjs http tomcat servlets

我有一个较旧的网站,而且我几个月来都没有得到维护(通过检查包括OS,Java,Servlet过滤器,web.xml等在内的时间戳进行了验证),今天早上它突然停止工作。我一直追踪到这个:

JavaScript:

var fd = new FormData();  
fd.append('action', 'getUserConfiguration')     
// sent using AngularJS $http service

提琴手:

POST https://X.com/X HTTP/1.1
Host: X.com
Connection: keep-alive
Content-Length: 157
Accept: application/json, text/plain, */*
Origin: https://X.com
Authorization: Bearer <omitted for clarity>
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBefuvbQ5DT0S3swB
Referer: https://X.com/x.html
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: <omitted for clarity>

------WebKitFormBoundaryBefuvbQ5DT0S3swB
Content-Disposition: form-data; name="action"

getUserConfiguration
------WebKitFormBoundaryBefuvbQ5DT0S3swB--

据我所知,到目前为止还好吗?但是:

Java8 / Tomcat7:

@MultipartConfig
public class X extends HttpServlet {
    public void doPost(HttpServletRequest httpRequest, HttpServletResponse httpResponse) {  
        String action = httpRequest.getParameter("action");

问题在于操作为null。我尝试从getInputStream()中转储原始内容,它也是一个空字符串。

有什么想法吗?

0 个答案:

没有答案