• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Map wild card url pattern to servlet  RSS feed

 
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
 
Rancher
Posts: 42975
76
  • 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
Posts: 42975
76
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!