Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL-Pattern Issue

 
Michael Cropper
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    Michael Cropper
    Ranch Hand
    Posts: 143
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Pie
    Posts: 64833
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 143
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ok, I will take a look and see what I can find

    Thanks for the speeds response!
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic