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

Absolute, Canonical, and relative path

 
Michael Santosa
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers....
I have servlet, lets name it as MyPath,
and I put this servlet under context : MyContext.
There are 3 possibilites about the path for this
servlet :
1. http:\\localhost:8080\MyContext\servlet\MyPath
(My opinion this is an absolute path)
2. \servlet\MyPath
(This is canonical path, relative to context,
because it starts with "\")
3. MyPath
(This is relative path to current page)
Am I right ? If I am wrong please correct me.
My next question is, I read book, tutorial
and some notes that always said absolute
and relative path.
For example :
public RequestDispatcher ServletContext.getRequestDispatcher(String path)-
accepts only absolute path, and not relative
path..
what is the meaning absolute path here ?
(Is it point 1 & 2 ? or point 2 only ?)
And also what is the meaning relative here ?
(point 3 only ?)
Thank you for the help.
Michael
 
R K Singh
Ranch Hand
Posts: 5382
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think as per SUN guys ..absolute path means relative path which get translated in to absolute path. I mean if path is "/somepage.jsp" it will be resolved in to http://myServer/myContext/somepage.jsp which is absolute path.
and if path is "somePage.jsp" then it will w.r.t current page i.e. if currnet page is http://myServer/myContext/someDir/dir02/page01.jsp then "somePage.jsp" must be in directory "dir02".
CMIW
HTH
[ June 23, 2002: Message edited by: Ravish Kumar ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic