| Author |
URL-Pattern Issue
|
Michael Cropper
Ranch Hand
Joined: Sep 30, 2009
Posts: 137
|
|
Hello, I must be missing something obvious here.
The URL pattern I am trying to use is;
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>package.homepage</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/servlet/test.*</url-pattern>
</servlet-mapping>
Although the URL "http://localhost:8080/package/servlet/text.sometext" does not work, whilst the URL "http://localhost:8080/package/sevlet/text.*" does work.
So the * is being treated as a literal character and not as a wildcard.
I have had a look around and I can't seem to find an explanation for this odd behaviour. I am using Tomcat v6 as my container.
Any ideas?
Regards,
Michael
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
whilst the URL "http://localhost:8080/package/sevlet/text.*" does work.
I doubt that, as there are two typos in that URL. Please take better care when posting to avoid red herrings.
In any case, your pattern is not one of the supported wildcard forms. You can use one of:
/prefix/*
or
/*.suffix
Your pattern does not fit one of these supported patterns.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Michael Cropper
Ranch Hand
Joined: Sep 30, 2009
Posts: 137
|
|
My bad on the typo
Can you recommend a good website for me to gather further knowledge on other patterns? I would also like to learn about including regular expressions within these (if possible) too.
I will look at fixing the current issue above with what you have suggested.
Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
The Servlet Specification is the best place to go for any information on Servlets.
But no, no other patterns, and certainly no regular expressions, are supported (at least by Servlets 2.x -- I haven't had a chance to really dive into Servlets 3.0 yet).
|
 |
Michael Cropper
Ranch Hand
Joined: Sep 30, 2009
Posts: 137
|
|
Ok, I will take a look and see what I can find
Thanks for the speeds response!
|
 |
 |
|
|
subject: URL-Pattern Issue
|
|
|