I’d like to create a servlet filter that applies to all my URL paths except for a few a specify (or ideally specified by a regex).
Is that possible? Unfortunately I can’t change the paths such that all of my other URLs start with something common….
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t do this via spec-compliant configuration. You do have a couple of options:
<filter-mapping>s so that they are much more specific (e.g./foobecomes/foo/barand/foo/bazbut not/foo/foo).<init-param>if you want to configure them inweb.xml, but you’ll have to do the real work yourself.<filter-mapping>s and<servlet-mapping>s that do share a common URI prefix and start using those (leaving the old mappings in effect).