Only 49 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Virtual Directory Translation  RSS feed

 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ServletContext object gives a method to get the method getRealPath(java.lang.String path) to get the physical directory of a particular virtual directory. I couldn't get what does mean bu virtual directory? Is it the directory structure where the web application is deployed? And the physical directory? Is that mean the real/actual path to the resource in a server? Please confirm it!

And why we can't accessed the resource with the virtual path? The resource should be the web application directory? Then?

Thanks...
 
Nilesh Miskin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A virtual directory structure is the one defined by the <url-pattern> element in the deployment descriptor.
getRealPath(String) returns a String containing real path from given virtual path. This method returns null if the servlet container cannot translate the virtual path to real path.
a typical case when this method returns null would be when the content is being made available from a .war archive.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!