This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Pipeline as Code and have Mohamed Labouardy on-line!
See this thread for details.
Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

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.
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic