Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet mapping not getting invoked

 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a directory - /news

I also have:

<servlet-mapping>
<servlet-name>blojsom</servlet-name>
<url-pattern>/news/*</url-pattern>
</servlet-mapping>

but if you go to http://dhtmlkitchen.com/news/ you get an apache directory listing of the directory /news. I do not want this. I want the blojsom servlet to be invoked.

What should I do? Can I fix this?
[ July 18, 2005: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which container are you using?
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's tomcat 5.5.
[ July 18, 2005: Message edited by: Garrett Smith ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like your connection between apache and tomcat is not configured correctly.

Moved to the Tomcat forum (where I believe this has been discussed before).
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not so sure that /news/ would invoke the servlet even without Apache's interferance without a /news (as opposed to /news/*) mapping -- but I'm not in a position to test it out at the moment.
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It matched it in TC 4.

And according to Head First Servlets, /news/* is a directory pattern and will match a directory path, even if it's missing an end slash (e.g. "/news").

I'm gonna search this forum to see if I can find that thread you mentioned.

Thanks,

Garrett
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is the topic that I was thinking of.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic