Securing Java web apps without filters
I notice that "use a Filter" is the common response for securing Java web apps. We posted a short how-to for using the built-in web app security tools. It's easy to use and it can interface easily with a user database and require SSL encryption, but the configuration can be tricky.
http://chiralsoftware.com/blog/Securing-Java-web-applications-11abd75d347e00ae.html
I hope this is helpful.
# 2
Declaring security constraints in web.xml (as described in the blog posting) will work on all containers, not just tomcat. The only tomcat-specific parts were defining the realm in server.xml and defining the users in tomcat-users.xml. Other containers would have different ways of providing those things. And they are all capable of providing realms. Filters give you no portability advantage over using Java security. I can't see any reason to use filters for authentication at this point.