[英]filter not working in servlet
My application is served from this URL - http://t4.gav.com/gui 我的应用程序是通过以下URL提供的: http://t4.gav.com/gui
Now I have added a Servlet filter to filter all requests with /gui/* pattern. 现在,我添加了一个Servlet过滤器,以/ gui / *模式过滤所有请求。
<filter>
<filter-name>AccessCheckFilter</filter-name>
<filter-class>t4.AccessCheckFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AccessCheckFilter</filter-name>
<url-pattern>/gui/*</url-pattern>
</filter-mapping>
I'm not sure why mistake Im doing. 我不确定为什么我会做错。 If I just give root "/" its working. 如果我只是给根“ /”它的工作。
If your application is served at http://t4.gav.com/gui most probably your context path of your application is /gui. 如果您的应用程序是通过http://t4.gav.com/gui提供的 ,则您的应用程序的上下文路径很可能是/ gui。 Which means, whatever you configure on your Servlet Filter is relative to this context path. 这意味着,无论您在Servlet过滤器上配置的内容如何,都是相对于此上下文路径的。 This is why / is working. 这就是为什么/起作用的原因。
Based on your configuration the container will filter the requests on URL /gui/gui/*. 根据您的配置,容器将过滤URL / gui / gui / *上的请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.