• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

full path

 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use getRealPath() of ServletContext.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic