I want to use expression language in some of my javascript files. So I set up a JSPServlet, mapped to all javscript files, so they could be evaluated:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>weblogic.servlet.JSPServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
Then it turned out that one of my js-files crashes on EL-evaluation, and I suddenly need to specify only the files that should be evaluated. I quickly found out that exceptions to a filter is not supported. Instead I changed the name of the js-files that contains expression language, to end with -el.js
. Then I updated all of my references to those scripts, and made my silter mapping url pattern look like this instead:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>weblogic.servlet.JSPServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*-el.js</url-pattern>
</servlet-mapping>
Turns out this is not accepted. I have tried to find the rules of URL-patterns, but been unable to locate them. I know I could just put the relevant files in a specific subfolder, and then use the folder as the url pattern, but after painstakingly updating every reference to all of the files, I was hoping that there might be an easier way to do this. And no matter what, I would definitely like to know the rules of url-patterns.
So what exactly are the rules of url patterns for java servlets? Can I use filenames-ending-with, where more than the file extension is specified, in any way?