• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wild cards in URL Mapping

 
S Guru
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone please suggest how can I achive this following mapping in web.xml,

Sample call,
1.)city/abc/street/*
2.)city/abd/street/*
3.)city/*/street/*


Please note that abc & abd are just strings. Please help.

servlet>
<servlet-name>com.city.Street</servlet-name>
<servlet-class>com.city.Street</servlet-class>
<init-param>
<param-name>city.properties</param-name>
<param-value>/WEB-INF/conf/city.properties</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>com.city.Street</servlet-name>
<url-pattern>city/*/street/*</url-pattern>
</servlet-mapping>
 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These type of wild-card patterns are not allowed in mapping of servlets in web.xml. A URL-pattern in web.xml is what starts with '/' and ends with '/*'(in case of multiple servlets). Try to use default mapping('/') or you have to come up with something else.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic