private static String convertToNamedBlobPath(String path) throws RestServiceException {
    // S3 requests are converted to named blob requests internally so that handling is same. For ex: if S3 path is "/s3/
    // my-account/my-container/directory/file", we convert it to "/named/my-account/my-container/directory/file".
    path = path.startsWith("/") ? path.substring(1) : path;
    String[] splitPath = path.split("/", 4);
    if (splitPath.length < 3 || splitPath[1].isEmpty() || splitPath[2].isEmpty()) {
      // Account-name and container name must always be present in s3 path.
      throw new RestServiceException(
          String.format("S3 Path must have format '/s3/<account_name>/container-name/<key-name>.  Received path='%s'",
              path), RestServiceErrorCode.BadRequest);
    }
    String accountName = splitPath[1];
    String containerName = splitPath[2];
    String keyName = splitPath.length > 3 ? splitPath[3] : "";
    String namedBlobPath =
        PATH_SEPARATOR_STRING + Operations.NAMED_BLOB + PATH_SEPARATOR_STRING + accountName + PATH_SEPARATOR_STRING
            + containerName + (keyName.length() > 0 ? PATH_SEPARATOR_STRING + keyName : "");
    logger.debug("Converted S3 path {} to Named Blob path {}", path, namedBlobPath);
    return namedBlobPath;
  }
Get named blob path from S3 request path
@param path s3 request path
@return named blob request path
ambry-api/src/main/java/com/github/ambry/rest/RequestPath.java