• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web.xml servlet url-pattern mapping problem

 
Brian M Smith
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if I'm going to be able to do this, but figured I would ask.

I need to create a servlet to handle multiple URL patterns. My servlet needs to be able to handle a pattern that looks like this /*/leftNav/*

I'm not a I little confused by what the servlet 2.4 spec means by "A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping." Does this mean multiple wildcard characters may not be used when defining a url-pattern? When I attempt to load the url http://localhost:8080/test/leftNav/somethinghere.js, I'm getting a blank page returned to me. This shouldn't be happen as the servlet will output a test string on the page.

Any ideas?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2264
76
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian,

Multiple wildcard characters in URL mapping is not allowed.

You have to options:
  • You either write all paths like: /test/leftnav/*
  • or
  • Use the default mapping "/" (as a last resort)

  • Regards,
    Frits
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 64613
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    General wild-card patterns are not supported. So, no, the leading wild-card will not work.

    What are you really trying to accomplish?
     
    Brian M Smith
    Ranch Hand
    Posts: 35
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Frits,

    Thank you for the reply. That is what I thought was going on. I will just come up with another solution.

    -Brian
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic