title: tomcat filter for all webapps
body: <p>Problem: i want to do filter for all webapps.</p>
  
  <p>I created a filter for monitoring requests to the apache tomcat server.</p>
  
  <p>for the sake of example, it's called MyFilter. i created it in netbeans, which created 2 separated directories:</p>
  
  <pre><code>webpages - contains:
      META-INF
      WEB-INF
      index.jsp (a file which i created for viewing monitored data)
  
  source packages
      my.package/MyFilter
  </code></pre>
  
  <p>in the same when i execute it from netbeans, it deploys it and sends me to <a href="http://localhost:8080/MyFilter" rel="noreferrer">http://localhost:8080/MyFilter</a></p>
  
  <p>whenever i view a page under /MyFilter/somepath - it runs the filter.</p>
  
  <p>i want the filter to run on all paths, and not only for the webapp</p>
  
  <p>Where do i need to locate the project files? which project files do i need? should i edit conf/web.xml and add the filter? or should i only be in the specific webapp's web.xml?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>i copied the generated .war file into tomcat/webapps</p>
  
  <p>when i start tomcat, it creates a directory (tomcat/webapps/MyFilter/)</p>
  
  <p>i added the filter into tomcat/conf/web.xml. when i start it, it fails to load ://localhost:8080/ but successfully loads (and filters) ://localhost:8080/MyFilter</p>