阻止web.xml中的一些http方法

a64a0gku  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(166)

我在一个tomcat中运行两个war文件。示例app1和app2。现在我想单独阻止app2的一些http方法,而不涉及tomcat自己的web.xml。因此,我为app2创建了一个web.xml,并将其放在web\u inf下。

<web-app>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>restricted methods</web-resource-name>
            <url-pattern>/*</url-pattern>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
        </web-resource-collection>
        <auth-constraint/>
    </security-constraint>
</web-app>

当我点击url作为 host:port/app2/ 它将给出403的响应。但是当我点击 host:port/app2 得到的回应是200。
现在我必须阻止 host:port/app2 这个url也是。如何更改url模式以实现这一点。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题