• 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

About servlet-mapping

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I create an TestServlet and add the following code into web.xml

I expected both (/TestServlet and /test/Testxxx) of them can map to TestServlet but only /TestServlet work properly.

Could anyone tell me why /test/Testxxx cannot (but /test/Test* work)?

Thanks in advance!!
Jack
[ June 21, 2004: Message edited by: Jack Lau ]
 
Bartender
Posts: 3908
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
howdy,

Let's see what the spec says:



SRV.11.2 Specification of Mappings
In theWeb application deployment descriptor, the following syntax is used to define
mappings:
� A string beginning with a �/� character and ending with a �/*� suffix is used
for 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, use either

/bla-bla/*

or

*.bla

but not

/bla-bla*

cheers,
MZ
 
Jack Lau
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much

Jack
reply
    Bookmark Topic Watch Topic
  • New Topic