aspose file tools*
The moose likes Servlets and the fly likes Different results for ServletContext.getRealPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
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 /.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Different results for ServletContext.getRealPath