my dog learned polymorphism
The moose likes Servlets and the fly likes opening a file in web-inf Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "opening a file in web-inf" Watch "opening a file in web-inf" New topic
Author

opening a file in web-inf

Johnny Gara
Ranch Hand

Joined: Mar 09, 2007
Posts: 43
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

Joined: Jan 10, 2002
Posts: 56222
    
  13

It's WEB-INF, not web-inf.

ServletContext.getResourceAsStream()
[ July 31, 2008: Message edited by: Bear Bibeault ]

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Johnny Gara
Ranch Hand

Joined: Mar 09, 2007
Posts: 43
ah, you are correct, thanks Bear

for completeness, the correct call would be

ServletContext.getResourceAsStream( "/WEB-INF/conf/config.xml");
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: opening a file in web-inf
 
Similar Threads
Issue with WAS 6.0/RAD 7.0
I got this error when start server in WSAD:
Spoiler Tag?
Struts validation[Very argent]
Problem in websphere Struts / Server config