Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http 基于内容类型的servlet响应_Http_Servlets_Http Headers_Http Post_Content Type - Fatal编程技术网

Http 基于内容类型的servlet响应

Http 基于内容类型的servlet响应,http,servlets,http-headers,http-post,content-type,Http,Servlets,Http Headers,Http Post,Content Type,调试服务器时,我遇到以下问题: 当http post头是 headers: {'Content-Type': 'application/x-www-form-urlencoded',} headers: {'Content-Type': 'application/json',} servlet post断点已激活 当http post头是 headers: {'Content-Type': 'application/x-www-form-urlencoded',}

调试服务器时,我遇到以下问题:

当http post头是

headers: {'Content-Type': 'application/x-www-form-urlencoded',}    
headers: {'Content-Type': 'application/json',}      
servlet post断点已激活

当http post头是

headers: {'Content-Type': 'application/x-www-form-urlencoded',}    
headers: {'Content-Type': 'application/json',}      
servlet post断点未激活,请求“无处可去”

为什么会这样?是否有默认过滤器或类似的东西


谢谢

我也有类似的问题。我认为理解正在发生的事情的最佳资源是servlet规范

见第页。44来自Servlet API规范:

以下是必须满足的条件 在发布表单数据之前满足 填充到参数集:

  • 该请求是HTTP或HTTPS请求
  • HTTP方法是POST
  • 内容类型为application/x-www-form-urlencoded
  • servlet已对任何 请求对象上的getParameter方法族
  • 如果不满足这些条件,则该职位 参数中不包括rm数据 设置后,post数据必须仍然可用 通过请求对象的输入发送到servlet 流动如果满足条件,则post fo rm数据将不再可用于 直接从请求对象的输入流读取