File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get DISK absolute path according URL

 
liang sun
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to get DISK absolute path according URL
Example: convert "http://sun:8080/a.jsp"
to "c:\aaa\a.jsp"
 
Tim Baker
Ranch Hand
Posts: 541
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can't unless you are inside that JSP page. Because you can map a context to anywhere on the disk you can't automatically know where it is. But if you are inside the JSP / Servlet you can use the context object and getRealPath to get the local path to the context.
[ November 09, 2003: Message edited by: Tim Baker ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand Tim's reply, that's not completely correct. You can use getRealPath() from anywhere inside a web app to find the path of a resource anywhere within the web application. You do not need to be within the resource itself.
bear
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic