• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

opening a file in web-inf

 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to open a config file that's located in web-inf/config/config.xml and was wondering what the best way to do so is.

Is it possible to open this file using classloaders? Or can you simple just try to open a stream to /web-inf/config/config.xml in your war file?

thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's WEB-INF, not web-inf.

ServletContext.getResourceAsStream()
[ July 31, 2008: Message edited by: Bear Bibeault ]
 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah, you are correct, thanks Bear

for completeness, the correct call would be

ServletContext.getResourceAsStream( "/WEB-INF/conf/config.xml");
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic