I have a URL in the following form...

 htts://www.mysite/admin/userprofile.do

Using a servlet filter I want to prevent certain things in part of the URL. Using the following in web.xml...

<filter-mapping>
    <filter-name>myFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

With an appropriate servlet-filter how could I change url-pattern to only manage the /admin/ portion of the URL (this is an old app that for whatever reason allows an XSS injection only in that portion). Is this possible?

有帮助吗?

解决方案

<url-pattern>/admin/*</url-pattern>

其他提示

You can achieve this like below :

    <filter-mapping>
      <filter-name>myFilter</filter-name>
      <url-pattern>/admin/*</url-pattern>
    </filter-mapping>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top