Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Map wild card url pattern to servlet

 
Terence Thant Zin Oo
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I save the images in the database and need to provide the URL to the users so that they can include in their pages.
For example, /img/a.jpg, /img/b.jpg...

I want to map /img/* to the servlet but it is not possible in Servlet version 2.4.

Have any of you encountered such problem?
If yes, please give me some suggestions.


Regards
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is that not possible? What have you tried?
 
Terence Thant Zin Oo
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf

I put the wrong url pattern in the previous post.
It should be /img/*.jpg.

I want the container to send back error 404 for other request such as /img/a/b/c.jpg or /img/a.gif.

It can be programatically (by checking request.getPathInfo()) but I want to do it in web.xml


Regards


 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, indeed - you can only map an extension or map a directory; not both at the same time.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic