• Post Reply Bookmark Topic Watch Topic
  • New Topic

Absolute, Root Relative, Non-Root Relative URI

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some books (Hanumant Deskmukh) describe
Absolute URI as "A URI that has a protocol, a hostname,and optionally a
port number".
RootRelative URI as "A URI that starts with a / and that does not have a
protocol, a hostname, or aport number. It is
interpreted as relative to the document root of the web
application.
Non-root Relative URI as "A URI that does not start with a / and
that does not have a protocol, a hostname,or a port number. It is interpreted as relative to either the currentJSP
page or the WEB-INF, depending on where it is used."


WHILE SOME OTHER BOOKS DESCRIBE

ABSOLUTE URI as starting with '/'
Relative URI as not starting with a '/'


Why the contradiction and what is the correct definitions of these terms...
[ September 20, 2007: Message edited by: Sandeep Vaid ]
 
Dagbj�rn Nogva
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sandeep,

This is how the javadoc page of java.net.URI defines absolute and relative URIs.

An absolute URI specifies a scheme; a URI that is not absolute is said to be relative.


This appears to be in line with Hanumant Deskmukh's definition.

Cheers,
Dagbj�rn
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP spec may clear your doubt concerning absolute and relative paths :

JSP.1.2.1 Relative URL Specifications
Elements may use relative URL specifications, called URI paths, in the Servlet 2.4 specification. These paths are as described in RFC 2396. We refer to the path part of that specification, not the scheme, nor authority parts. Some examples are:
� A context-relative path is a path that starts with a slash (/). It is to be interpreted as relative to the application to which the JSP page or tag file belongs. That is, its ServletContext object provides the base context URL.
� A page relative path is a path that does not start with a slash (/). It is to be interpreted as relative to the current JSP page, or the current JSP file or tag file, depending on where the path is being used. For an include directive (see Section JSP.1.10.3) where the path is used in a file attribute, the interpretation is relative to the JSP file or tag file. For a jsp:include action (see Section JSP.5.4) where the path is used in a page attribute, the interpretation is relative to the JSP page. In both cases the current page or file is denoted by some path starting with / that is then modified by the new specification to produce a path starting with /. The new path is interpreted through the Servlet-Context object. See Section JSP.1.10.5 for exact details on this interpretation.
The JSP specification uniformly interprets paths in the context of the web container where the JSP page is deployed. The specification goes through a mapping translation. The semantics outlined here apply to the translation-time phase, and to the request-time phase.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!