Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext.getRealPath

 
Arockia Raj
Ranch Hand
Posts: 39
  • 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
  • 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: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic