Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/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
Servlets 严重-对于URL模式为[/*]的安全约束,HTTP方法[POST GET]未被覆盖_Servlets_Web.xml - Fatal编程技术网

Servlets 严重-对于URL模式为[/*]的安全约束,HTTP方法[POST GET]未被覆盖

Servlets 严重-对于URL模式为[/*]的安全约束,HTTP方法[POST GET]未被覆盖,servlets,web.xml,Servlets,Web.xml,我在启动Tomcat时遇到以下错误: 严重-对于URL模式为[/*]的HTTP 方法[POST-GET]未被发现 这是什么原因? 我认为这是一个不同的问题 My web.xml看起来像: <security-constraint> <display-name>Restrict resources</display-name> <web-resource-collection> <web-resource-na

我在启动Tomcat时遇到以下错误:

严重-对于URL模式为[/*]的HTTP 方法[POST-GET]未被发现

这是什么原因?


我认为这是一个不同的问题

My web.xml看起来像:

<security-constraint>
    <display-name>Restrict resources</display-name>
    <web-resource-collection>
        <web-resource-name>/resources dir</web-resource-name>
        <url-pattern>/resources/*</url-pattern>
    </web-resource-collection>
    <auth-constraint />
</security-constraint>

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Whitelist</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method-omission>GET</http-method-omission>
        <http-method-omission>POST</http-method-omission>
    </web-resource-collection>
    <auth-constraint />
</security-constraint>

限制资源
/资源主任
/资源/*
白名单
/*
得到
邮递

因此,我试图禁止所有方法,除了
GET
POST
(请参阅)。但是,有些方法(
PUT
DELETE
OPTIONS
…)似乎会返回一个“
302 Found
”而不是一个自动的
403
,不知道为什么(缺少请求参数?)。

在我看来,你实际上也禁止
GET
POST
。请尝试以下操作,而不是第二个
部分中的空

<auth-constraint>
  <role-name>*</role-name>
</auth-constraint>

在我看来,你实际上也禁止
GET
POST
。请尝试以下操作,而不是第二个
部分中的空

<auth-constraint>
  <role-name>*</role-name>
</auth-constraint>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1"
  metadata-complete="true">