| Author |
web.xml url-pattern wildcards?
|
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
My current servlet url is:
http://localhost:8080/MyWebApp/en/pp/login.html
How should I change my web.xml file so replacing "en" with any value would work? E.g.,
http://localhost:8080/MyWebApp/hk/pp/login.html
http://localhost:8080/MyWebApp/es/pp/login.html
etc.
My current web.xml snippet:
Have tried the "*" wildcard, but with no success. If it's not possible, what other method can I use?
Thanks in advance,
James
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
James,
Besides listing them all? Can you change URLs to one of:
http://localhost:8080/MyWebApp/lang/en/pp/login.html
http://localhost:8080/MyWebApp/pp/en/login.html
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
Hiya Jeanne,
Yes, I could change it to either of those. Do you have a solution based on that?
Thank you,
James
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
Just map the prefix to a servlet, and within the servlet, use getPathInfo() to get the rest of the URL.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
Thanks. Like...
with urls http://localhost:8080/MyWebApp/pp/Login/hk.html and http://localhost:8080/MyWebApp/pp/Login/hk.wml
It works, but will be a pain changing all the dynamic link code...
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
Yeah, the Servlet specification doesn't give us a whole lot of leeway in creating URL patterns with wildcards. We essentially get the choice of a trailing wildcard, or a filename wildcard.
|
 |
 |
|
|
subject: web.xml url-pattern wildcards?
|
|
|