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

Different results for ServletContext.getRealPath

 
Reginald Law
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed that JRun tags on a file path seperator for the method ServletContext.getRealPath, where as Apache Tomcat does not append it on. I am calling the method from the init method in the servlet.

How does one get around this so code does not have to be changed from one application server to another one ?
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code (which has not been compiled or tested) assumes that all your other code *expects* your paths to end with /.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic