public URI normalize ()

Normalizes this URI's path.

If this URI is opaque, or if its path is already in normal form, then this URI is returned. Otherwise a new URI is constructed that is identical to this URI except that its path is computed by normalizing this URI's path in a manner consistent with RFC 2396, section 5.2, step 6, sub-steps c through f; that is:

  1. All "." segments are removed.

  2. If a ".." segment is preceded by a non- ".." segment then both of these segments are removed. This step is repeated until it is no longer applicable.

  3. If the path is relative, and if its first segment contains a colon character ( ':'), then a "." segment is prepended. This prevents a relative URI with a path such as "a:b/c/d" from later being re-parsed as an opaque URI with a scheme of "a" and a scheme-specific part of "b/c/d". (Deviation from RFC 2396)

A normalized path will begin with one or more ".." segments if there were insufficient non- ".." segments preceding them to allow their removal. A normalized path will begin with a "." segment if one was inserted by step 3 above. Otherwise, a normalized path will not contain any "." or ".." segments.

Returns:  A URI equivalent to this URI, but whose path is in normal form