Do you really mean to use `getServletPath` rather than, say, `getPathTranslated` or `getRequestURI`? `getServletPath` is documented to be `""` if the processing servlet was matched using `/*`, which is in fact how `war/src/main/webapp/WEB-INF/web.xml` specifies it.