private void setSignedIdMetadataAndBlobSize(BlobProperties blobProperties) throws RestServiceException {
      if (RestUtils.isChunkUpload(restRequest.getArgs())) {
        Map<String, String> metadata = new HashMap<>(2);
        metadata.put(RestUtils.Headers.BLOB_SIZE, Long.toString(restRequest.getBlobBytesReceived()));
        metadata.put(RestUtils.Headers.SESSION,
            RestUtils.getHeader(restRequest.getArgs(), RestUtils.Headers.SESSION, true));
        metadata.put(EXPIRATION_TIME_MS_KEY,
            Long.toString(Utils.addSecondsToEpochTime(time.milliseconds(), blobProperties.getTimeToLiveInSeconds())));
        if (blobProperties.getReservedMetadataBlobId() != null) {
          metadata.put(RestUtils.Headers.RESERVED_METADATA_ID, blobProperties.getReservedMetadataBlobId());
        } else {
          ReservedMetadataIdMetrics.getReservedMetadataIdMetrics(
              frontendMetrics.getMetricRegistry()).noReservedMetadataFoundForChunkedUploadResponseCount.inc();
          throwRestServiceExceptionIfEnabled(new RestServiceException("No reserved metadata id present to set in chunked upload response",
                RestServiceErrorCode.BadRequest), router.getRouterConfig().routerReservedMetadataEnabled);
        }
        restRequest.setArg(RestUtils.InternalKeys.SIGNED_ID_METADATA_KEY, metadata);
      }
      //the actual blob size is the number of bytes read
      restResponseChannel.setHeader(RestUtils.Headers.BLOB_SIZE, restRequest.getBlobBytesReceived());
    }
Attach the metadata to include in a signed ID to the {@link RestRequest} if the request is for a chunk upload.
This will tell the ID converter that it needs to produce a signed ID to give back to the client.
@param blobProperties the {@link BlobProperties} from the request.
@throws RestServiceException
ambry-frontend/src/main/java/com/github/ambry/frontend/PostBlobHandler.java