code: public static URI toDirectory(final URI uri, final boolean strict) throws NormalizationException {
          return resolve(uri, getRawDirectory(uri, strict), strict);
      }
docs: Returns a URI that has been truncated to its directory.
  
  @param uri the URI to resolve to the directory level
  @param strict whether or not to do strict escaping
  @return the resolved and normalized  URI
  @throws NormalizationException if there was a problem normalizing the URL