*
The moose likes Servlets and the fly likes opening a file in web-inf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
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: 60822
    
  65

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

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

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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");
 
 
subject: opening a file in web-inf
 
Similar Threads
Issue with WAS 6.0/RAD 7.0
Spoiler Tag?
I got this error when start server in WSAD:
Problem in websphere Struts / Server config
Struts validation[Very argent]