• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to know the path

 
sreedhar Lackka
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Thanks.
We are keeping our some static contents on webserver (IHS). and in my java/action file if I want that path what should I do?
I want to know the webserver path.
I tried with contextpath it is giving me appl.server.

Please help me

Regards,
Sree
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to get an absolute file system path based on the relative web context path?
If so, you can use ServletContext#getRealPath() for that. Also see the API docs.
 
Paul Clapham
Sheriff
Posts: 21111
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand the question correctly, this file is not within the web application's context. It's being served by the web server which sits between the application server and the network. Presumably the two servers are on the same machine, which is why sreedhar thinks this question should have an answer. If they were on different machines, then clearly it wouldn't have an answer, and that suggests to me that there's nothing in the Servlet API which will produce the path.

If it were me I would go back and look for a solution to the unstated problem which didn't require knowing that path. Or I would hard-code the path as an application parameter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic