• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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 ]
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic