This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello, Have coded a Filter to authenticate users. I've got log4j going to trace what's happening. It records the "init" method, but the trace statement in the doFilter method never gets called--it's the first statement in the method. The filter-mapping, url-pattern element in the app's web.xml looks like: <url-pattern>/tomcat-docs/*</tomcat-docs> (I'm filtering the tomcat-docs as proof-of-concept) Also, am using tomcat 5.5. Anyone have any idea why the doFilter method apparently never gets called? Also, turned on request tracing, and the log shows that the tomcat-docs are getting requested. Have the class jarred up and placed in the tomcat-docs/WEB-INF/lib directory. Also, coded the doFilter method to throw an exception after logging statement. Not getting called. Thanks in advance!
Originally posted by Douglas Kent: "tomcat-docs" is the context path, right? So "/tomcat-docs/*" should match every request
As I said, and Vivek has repeated, the context path is not part of the URL that you can match on. In order to keep web apps indepenedent of their context path (which should be hard-coded nowhere in the app), matching happens on everything after the context path.