static void replaceRequestPathWithNewOperationOrBlobIdIfNeeded(RestRequest restRequest,
      DatasetVersionRecord datasetVersionRecord, String version) throws RestServiceException {
    if (version.equals("LATEST") || version.equals("MAJOR") || version.equals("MINOR") || version.equals("PATCH")
        || version.equals("REVISION")) {
      RequestPath originalRequestPath = (RequestPath) restRequest.getArgs().get(REQUEST_PATH);
      String originalOperationOrBlobId = originalRequestPath.getOperationOrBlobId(false);
      int index = originalOperationOrBlobId.lastIndexOf(PATH_SEPARATOR_STRING);
      String latestOperationOrBlobId;
      if (index != -1) {
        latestOperationOrBlobId =
            originalOperationOrBlobId.substring(0, index) + PATH_SEPARATOR_STRING + datasetVersionRecord.getVersion();
      } else {
        throw new RestServiceException("Failed to parse the originalOperationOrBlobId: " + originalOperationOrBlobId,
            RestServiceErrorCode.BadRequest);
      }
      RequestPath newRequestPath =
          new RequestPath(originalRequestPath.getPrefix(), originalRequestPath.getClusterName(),
              originalRequestPath.getPathAfterPrefixes(), latestOperationOrBlobId, originalRequestPath.getSubResource(),
              originalRequestPath.getBlobSegmentIdx());
      restRequest.setArg(RestUtils.InternalKeys.REQUEST_PATH, newRequestPath);
    }
  }
Refresh the OperationOrBlobId in request path with the specific latest version info.
@param restRequest the {@link RestRequest}
@param datasetVersionRecord the {@link DatasetVersionRecord} which include the version info.
@throws RestServiceException
ambry-frontend/src/main/java/com/github/ambry/frontend/FrontendUtils.java