This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler on-line!
See this thread for details.
The moose likes Servlets and the fly likes full path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "full path" Watch "full path" New topic
Author

full path

Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi,
Is it possible to get full contextPath that is
if we have a context like http://localhost:8080/examples/servlet/HelloWorldExample

Now is it possible to retrieve the physical location of examples folder. ?
say like C:\Tomcat\webapps\examples


Regards
Balaji
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Use getRealPath() of ServletContext.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Thanks Anthony,It worked for me.
System.out.println("Actual Path=>" +getServletContext().getRealPath(""));
Now looking at the servlet api's to learn more tricks.
Regards
Balaji
 
Consider Paul's rocket mass heater.
 
subject: full path
 
jQuery in Action, 3rd edition