private void validateBlobName(String blobName) throws RestServiceException {
    // ref: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html
    boolean isPrevWhitespace = false;

    Set<Character> invalidAsciiBlobNameCharsSet =
        frontendConfig.invalidAsciiBlobNameChars.stream().map(s -> s.charAt(0)).collect(Collectors.toSet());

    for (int i = 0; i < blobName.length(); i++) {
      char c = blobName.charAt(i);

      // Check for two consecutive whitespace characters
      if (Character.isWhitespace(c)) {
        if (isPrevWhitespace) {
          throw new RestServiceException("Blob name contains consecutive whitespace characters",
              RestServiceErrorCode.BadRequest);
        }
        isPrevWhitespace = true;
      } else {
        isPrevWhitespace = false;
      }

      // Check for control characters or invalid characters
      if (Character.isISOControl(c) || invalidAsciiBlobNameCharsSet.contains(c)) {
        throw new RestServiceException("Blob name contains control or disallowed character: " + c,
            RestServiceErrorCode.BadRequest);
      }
    }

    // Check for disallowed path patterns
    if (blobName.startsWith("../") || blobName.startsWith("./") || blobName.contains("/../") || blobName.contains(
        "/./")) {
      throw new RestServiceException("Blob name contains disallowed path pattern", RestServiceErrorCode.BadRequest);
    }
  }
Handle any basic checks, call {@link SecurityService#preProcessRequest}, and parse the URI to find a blob ID or
operation, and maybe a sub-resource. {@code routingAction} is used to choose how to handle the request based on
parsed URI.
@param restRequest the {@link RestRequest}.
@param restResponseChannel the {@link RestResponseChannel}.
@param preProcessingMetrics metrics instance for recording pre-processing time.
@param routingAction called with the parsed {@link RequestPath} as an argument. Used to start request handling
                     based on operation type.
ambry-frontend/src/main/java/com/github/ambry/frontend/FrontendRestRequestService.java