配filter结果却404,不解(tomcat)
uniqs 2006-02-21 11:38:37 在tomcat下,webapps下面,新建了一个web应用a
然后写了一个简单的filter,直接接过response
print一行文本.然后写web.xml.之后试图访问.
http://localhost/a/filter/xxx
结果404.
我不解,在webapps/a下面放了一个1.html.
http://localhost/a/1.html
404 again.
我修改了web.xml成
<web-app />
然后访问
http://localhost/a/1.html
OK.
请问这是怎么回事啊,和Tomcat的设置有关吧.
Tomcat:5.5.15
filter用的web.xml见下面.
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<filter>
<filter-name>Hello</filter-name>
<filter-class>MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Hello</filtername>
<url-pattern>/filter/*</url-pattern>
</filter-mapping>
</web-app>