File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext.getRealPath

 
Arockia Raj
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to access xsl file inside the servlet.The xsl file is available inside the webapplication.I have used the following method for accessing the realpath of the file.
ServletContext.getRealPath(/../filename).

It's working fine in windows environment.When we moved the application to unix environment ServletCOntext.getRealPath is returning null.


Kindly help us in resolving this issue.

Thanks in advance,

regards
ARaj
 
Shahnawaz Shakil
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the content to which the path is refering is available as part of war file? If it is the case then this method will return null.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arockia Raj:
ServletContext.getRealPath(/../filename).
That will fail without quotes for the string.

ServletCOntext.getRealPath is returning null.

It's ServletContext, not ServletCOntext.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic