• Post Reply Bookmark Topic Watch Topic
  • New Topic

in plug in, relative file path  RSS feed

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a plug in that wants the name of a config file. It looks something like:



In development we just use an absolute pathname for "aFile". This doesn't fly for production. Questions:

1) Where's a good place to put theFile.xml? We're trying to put it in WEB-INF currently.

2) How can we refer to this using a relative path? Is there some ServletContext call that can return WEB-INF's path? If so we could then finish building the config file's path.

Thanks for any help!
[ February 14, 2006: Message edited by: Tony Smith ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WEB-INF is a great place to put this file.

servletContext.getRealPath("/") will give you the actual file path for the context root of your application on whatever host system it may be on. Hence, you can get the WEB-INF directory with:

servletContext.getRealPath("/") + "/WEB-INF"
[ February 14, 2006: Message edited by: Merrill Higginson ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!