0

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.

5
  • 1
    What have you tried? Why didn't it work? You need to show us that you have at least put in a little effort. Commented Dec 13, 2013 at 12:14
  • Also it's usually a good idea to put css,js,imgs into separate folder for static resources. Commented Dec 13, 2013 at 12:17
  • I am not able to find that negate url pattern. that is how can I exclude static folder. Commented Dec 13, 2013 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 <servlet-name> element within the filter mapping and provide it the name of a servlet which, if called, will cause this filter to execute. Commented Dec 13, 2013 at 13:44
  • stackoverflow.com/questions/8496552/… Commented Dec 13, 2013 at 18:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.