aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Absolute, Canonical, and relative path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Absolute, Canonical, and relative path" Watch "Absolute, Canonical, and relative path" New topic
Author

Absolute, Canonical, and relative path

Michael Santosa
Greenhorn

Joined: Mar 13, 2002
Posts: 19
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

Joined: Oct 15, 2001
Posts: 5371
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 ]

"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Absolute, Canonical, and relative path