Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading a properties file from the war file

 
mat buckland
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a properties file located in the root of the war file.

How do I read in that properties file when the servet is deployed?

thanks
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what ServletContext.getResourceAsStream is for.

You may want to move the file from the web app root into the WEB-INF directory, though, lest it becomes publicly accessible.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic