• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to wildcard mappings to a servlet URI?

 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet which I want to handle requests from two separate URIs, and I need to create a servlet mapping which enables this. For example I want all requests from /myapp/one and /myapp/two to be handled by servletOne. I have tried the below in my web.xml but it doesn't do the trick:

<servlet>
<servlet-name>servletOne</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>servletOne</servlet-name>
<url-pattern>/[one|two]/*</url-pattern>
</servlet-mapping>


Can anyone see what I've done wrong? Should I instead use two separate servlet mappings?

Thanks in advance for your help.


--James
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use two mappings.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!