Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Absolute, Canonical, and relative path

Posts: 19
  • 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
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.
Ranch Hand
Posts: 5390
Spring Java
  • 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".
[ June 23, 2002: Message edited by: Ravish Kumar ]
That new kid is a freak. Show him this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic