I am writing a servlet filter and want to define a url pattern in web.xml in such a way that all the css, javascript and png files gets filtered and my filter executes only on the rest of the files.Can anyone give some pointers on the same.What url pattern to put in web.xml so that it excludes the static resources.
Asked
Active
Viewed 120 times
0
-
1What have you tried? Why didn't it work? You need to show us that you have at least put in a little effort. – Keppil Dec 13 '13 at 12:14
-
Also it's usually a good idea to put css,js,imgs into separate folder for static resources. – yatul Dec 13 '13 at 12:17
-
I am not able to find that negate url pattern. that is how can I exclude static folder. – Vikram Dec 13 '13 at 12:42
-
use something like `*.htm`. It will not intercept any of your static resources but you will have to match this pattern whenever you make an HTTP call to the servlet. Alternatively, you can also use the `
` element within the filter mapping and provide it the name of a servlet which, if called, will cause this filter to execute. – Anugoonj Dec 13 '13 at 13:44 -
http://stackoverflow.com/questions/8496552/specify-negative-path-match-for-servlet-mapping – Aksel Willgert Dec 13 '13 at 18:57