@Override
  public void addContent(HttpContent httpContent) throws RestServiceException {
    if (!isOpen()) {
      nettyMetrics.multipartRequestAlreadyClosedError.inc();
      throw new RestServiceException("The request has been closed and is not accepting content",
          RestServiceErrorCode.RequestChannelClosed);
    } else {
      long bytesReceivedTillNow = bytesReceived.addAndGet(httpContent.content().readableBytes());
      if (bytesReceivedTillNow > maxSizeAllowedInBytes) {
        throw new RestServiceException("Request is larger than allowed size", RestServiceErrorCode.RequestTooLarge);
      }
      rawRequestContents.add(ReferenceCountUtil.retain(httpContent));
    }
  }
Adds content that will be decoded on a call to {@link #prepare()}.
</p>
All content has to be added before {@link #prepare()} can be called.
@param httpContent the {@link HttpContent} that needs to be added.
@throws RestServiceException if request channel has been closed.
ambry-rest/src/main/java/com/github/ambry/rest/NettyMultipartRequest.java