原文出处:http://www.denghuafeng.com/post-304.html
假如nutz配置了全匹配
<filter>
<filter-name>nutzMultiView</filter-name>
<filter-class>org.nutz.mvc.NutFilter</filter-class>
<init-param>
<param-name>modules</param-name>
<param-value>com.itrys.MainModule</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>nutzMultiView</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
例如:http://www.itrys.com/index
不想请求http://www.itrys.com/index.html或http://www.itrys.com/index.nutz等添加其他后缀时,都会访问这个连接对应module的对应的方法,而是返回404。
解决方法如下:
<filter>
<filter-name>nutzMultiView</filter-name>
<filter-class>org.nutz.mvc.NutFilter</filter-class>
<init-param>
<param-name>modules</param-name>
<param-value>com.itrys.MainModule</param-value>
</init-param>
<init-param>
<param-name>exclusions</param-name>
<param-value>*[.].*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>nutzMultiView</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
配置exclusions的值为*[.].* Nutz全匹配时,不想它啥后缀都匹配的解决方法