• Post Reply Bookmark Topic Watch Topic
  • New Topic

[web.xml] url-pattern with "*"  RSS feed

 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A while back I posted a similar question:
http://www.coderanch.com/t/356179/Servlets/java/filter-mapping-excludes
I'm having trouble matching URL patterns within web.xml.
If I want to match anything that ends in utils.js, what should I use? I tried:

This doesn't match what I want it to. I don't know what it matches.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok... according to the servlet 2.3 spec it says
SRV.6.2.4 Configuration of Filters in a Web Application:
"When processing a filter-mapping element using the url-pattern style, the container must determine whether the url-pattern matches the request URI using the path mapping rules defined in Chapter SRV,11..."
SRV.11.2 Specification of Mappings:
"- A String beginning with a '/' character and ending with a '/*' postifix is used for a path mapping
- A String beginning with a '*.' prefix is used as an extension mapping
- A string containing only the '/' character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null.
- All other strings are used for exact matches only."
So.... with those rules in mind -- it looks like your choices are either to use the '*.' extension mapping for ALL *.js files -- or define a bunch of EXACT mappings for all the possible "utils.js" files in your app.
Hope that helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!