• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wildcard mapping

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm converting a site over from using Resin 2.1 (which I'm a lot more familiar with than Tomcat), and I have a question about wildcard mapping. At the moment in the Resin's web.xml file, I have the following:



This basically means that MainServlet will handle all URLs except those matching the patterns specified. I'm not sure how to do the equivalent in Tomcat. I could easily simplify it so that anything with a suffix other than .jsp is handled by a file servlet (i.e, treated as a static page), URLs ending in .jsp are handled by the JSP servlet, and anything without a suffix is handled by MainServlet. How can I accomplish this with Tomcat?

(I should add that if I were designing it from scratch, I would do it the other way round, and ensure that any URLs which needed to be handled by my servlet had an identifiable suffix, but I'm not in a position to do that now, and have to handle whatever is thrown at me).
[ March 16, 2006: Message edited by: Jan Hansen ]
 
Jan Hansen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I found a kind of solution, although not one I think is especially elegant, which is to do the following for each specific suffix I need the default servlet to handle (much as in the Resin example):



How come the servlet API is so lame in this respect, with regard to pattern matching? Surely the ability to handle regular expressions should not be beyond modern servlet containers?

Incidentally, I should have pointed out that this is in a standalone Tomcat environment, i.e., without Apache, hence the need to handle static pages.
 
Good night. Drive safely. Here's a tiny ad for the road:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic