I have a @WebServlet("") and a @WebFilter(urlPatterns = {"", "/", "/*"}, asyncSupported = true)
But the filter is not being invoked for the servlet 🙁
I am using @WebServlet("") instead of @WebServlet("/") based on instructions in: http://www.java.net/node/700651?force=613
I am using the Glassfish version bundled in the latest Java EE 6 SDK bundled with Java SE 7. (I switched from using the latest GA of Jetty because Jetty incorrectly implements @WebServlet(""))
This is a bug in Glassfish and according to a kind member on the Glassfish forum: http://www.java.net/node/700651#comment-821081 the workaround is to filter by servlet name in addition to the URL patterns. This also requires giving a name to the servlet. So the annotations would be:
@WebServlet(name = "foo", urlPatterns = "")and@WebFilter(servletNames = "foo", urlPatterns = {"", "/*"})and once the bug is fixed you can remove the name of the servlet and the explicit reference to it in the filter.