wood burning stoves 2.0*
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: full path