code: public static String getUniqueId(URI resourceUri, URI basePath) {
          String result = null;
          URI relativeUri = basePath.relativize(resourceUri);
          // If it is relative the first part of the path is the Unique ID
          if (!relativeUri.isAbsolute()) {
              result = relativeUri.toASCIIString();
              int slashIndex = result.indexOf('/');
              int hashIndex = result.indexOf('#');
              if (slashIndex > -1) {
                  result = result.substring(0, slashIndex);
              } else if (hashIndex > -1) {
                  result = result.substring(0, hashIndex);
              }
          }
          return result;
      }
docs: Given the URI of a resource it returns the Unique ID.
  In reality this obtains the first path element after the basePath.
  Checks for those that are local to the server only. Developed both for hash and slash URIs.
  
  Works in iServe on the basis of the following assumption behind resource URIs:
  
  http://host:port/...some...path.../{uniqueResourceId}#fragment
  or
  http://host:port/...some...path.../{uniqueResourceId}/subPart
  
  The result should be {uniqueResourceId}
  
  @param resourceUri the actual resource URI
  @param basePath    the base path of the URI
  @return the uniqueId if it is a local URI to the server or null.