private void setHeadResponseHeaders(BlobInfo blobInfo, GetBlobOptions options, RestRequest restRequest,
      RestResponseChannel restResponseChannel) throws RestServiceException {
    BlobProperties blobProperties = blobInfo.getBlobProperties();
    if (blobProperties.getContentType() != null) {
      restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, blobProperties.getContentType());
    }
    if (blobProperties.getContentEncoding() != null) {
      restResponseChannel.setHeader(Headers.CONTENT_ENCODING, blobProperties.getContentEncoding());
    }
    restResponseChannel.setHeader(RestUtils.Headers.ACCEPT_RANGES, RestUtils.BYTE_RANGE_UNITS);
    long contentLength = blobProperties.getBlobSize();
    if (options.getRange() != null) {
      Pair<String, Long> rangeAndLength =
          RestUtils.buildContentRangeAndLength(options.getRange(), contentLength, options.resolveRangeOnEmptyBlob());
      restResponseChannel.setHeader(RestUtils.Headers.CONTENT_RANGE, rangeAndLength.getFirst());
      contentLength = rangeAndLength.getSecond();
    }
    restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, contentLength);
    setBlobPropertiesHeaders(blobProperties, restResponseChannel);
    setAccountAndContainerHeaders(restRequest, restResponseChannel);
    restResponseChannel.setHeader(RestUtils.Headers.LIFE_VERSION, blobInfo.getLifeVersion());
    if (blobInfo.getBlobProperties().getReservedMetadataBlobId() != null) {
      restResponseChannel.setHeader(
          Headers.RESERVED_METADATA_ID, blobInfo.getBlobProperties().getReservedMetadataBlobId());
    }
  }
Sets the required headers in the HEAD response.
@param blobInfo the {@link BlobInfo} to refer to while setting headers.
@param options the {@link GetBlobOptions} associated with the request.
@param restRequest the {@link RestRequest} that was received.
@param restResponseChannel the {@link RestResponseChannel} to set headers on.
@throws RestServiceException if there was any problem setting the headers.
ambry-frontend/src/main/java/com/github/ambry/frontend/AmbrySecurityService.java