aspose file tools
The moose likes Servlets and the fly likes Different results for ServletContext.getRealPath Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Different results for ServletContext.getRealPath " Watch "Different results for ServletContext.getRealPath " New topic
Author

Different results for ServletContext.getRealPath

Reginald Law
Greenhorn

Joined: Jan 21, 2004
Posts: 19
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 ?


SCJP 1.4
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

The following code (which has not been compiled or tested) assumes that all your other code *expects* your paths to end with /.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Different results for ServletContext.getRealPath
 
Similar Threads
Different results for ServletContext.getRealPath
Get Host appbase Path of a JSP in Tomcat
relative path problem
Path to config file
Getting absolute path of image file