我已将以下内容放在我的应用程序的 web.xml 中以尝试禁止 PUT、DELETE 等:
<security-constraint>
<web-resource-collection>
<web-resource-name>restricted methods</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>PUT</http-method>
<http-method>SEARCH</http-method>
<http-method>COPY</http-method>
<http-method>MOVE</http-method>
<http-method>PROPFIND</http-method>
<http-method>PROPPATCH</http-method>
<http-method>MKCOL</http-method>
<http-method>LOCK</http-method>
<http-method>UNLOCK</http-method>
<http-method>delete</http-method>
<http-method>put</http-method>
<http-method>search</http-method>
<http-method>copy</http-method>
<http-method>move</http-method>
<http-method>propfind</http-method>
<http-method>proppatch</http-method>
<http-method>mkcol</http-method>
<http-method>lock</http-method>
<http-method>unlock</http-method>
</web-resource-collection>
<auth-constraint />
</security-constraint>
Run Code Online (Sandbox Code Playgroud)
好的,现在:
如果我使用方法提出请求,DELETE
我会得到 403 返回。
如果我使用方法提出请求,delete
我会得到 403 返回。
但
如果我用DeLeTe
我的方法做一个请求就OK了!
我怎样才能让它禁止这些不区分大小写的?
编辑:我正在用 C# 程序测试它:
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "making request";
System.Threading.Thread.Sleep(400);
WebRequest req = WebRequest.Create("http://serverurl/Application/cache_test.jsp");
req.Method = txtMethod.Text;
try
{
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
textBox1.Text = …
Run Code Online (Sandbox Code Playgroud) 我有一个在 Tomcat 6 上的开发服务器。我刚刚安装了 Tomcat 8,并注意到它不再在页面点击时重新编译 JSP。我必须在 server.xml 中更改什么才能让它在页面点击时重新编译它们?
注意:有人指出我http://tomcat.apache.org/tomcat-8.0-doc/config/loader.html但我认为这不能回答这个问题,因为我不关心在下面重新加载 jars 或类文件/WEB-INF/classes/
或者/WEB-INF/lib
,只是重新编译 JSP。
如果由于某种原因这不能在 Tomcat 8 中完成,它可以在 Tomcat 7 中完成吗?