Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.getProperty("server.root") not working in resin1.2.2

 
Srinath R
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Their is a function System.getProperty("server.root") which returns the directory in which the webserver is present or atleast this is what it does when it is used in javawebserver but when the same is used in resin1.2.2 it returns null, does this function have any other counrterpart when used on resin
if yes then tell me what is the function, or anyother way by which i can get the path in which my resin is present.
Srinath
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Call me a curmudgeon but I don't know if a function like that would be a good idea. Surely if a well-behaved web-app needs some filesystem resource, it should be installed somewhere relative to the root of that web-app, not in the server directory.
Doesn't ServletContext.getResource*() fit the bill?
- Peter
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must remember that Sun's JavaWebServer is, despite it's history, a very non-standard implementation. Modern standards-conformant servlet containers (Tomcat, Resin, Jetty, JRun, Orion, and many more) don't support this use of system properties - it would cause all sorts of problems if more than one web application is running in the container.
To get files in the document root of the current web application, you can use getServletContext().getRealPath(filename), which returns the full path to the file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic