private HttpResponse executeUploadInitiation(GenericUrl initiationRequestUrl) throws IOException {
    updateStateAndNotifyListener(UploadState.INITIATION_STARTED);

    initiationRequestUrl.put("uploadType", "resumable");
    HttpContent content = metadata == null ? new EmptyContent() : metadata;
    HttpRequest request =
        requestFactory.buildRequest(initiationRequestMethod, initiationRequestUrl, content);
    initiationHeaders.set(CONTENT_TYPE_HEADER, mediaContent.getType());
    if (isMediaLengthKnown()) {
      initiationHeaders.set(CONTENT_LENGTH_HEADER, getMediaContentLength());
    }
    request.getHeaders().putAll(initiationHeaders);
    HttpResponse response = executeCurrentRequest(request);
    boolean notificationCompleted = false;

    try {
      updateStateAndNotifyListener(UploadState.INITIATION_COMPLETE);
      notificationCompleted = true;
    } finally {
      if (!notificationCompleted) {
        response.disconnect();
      }
    }
    return response;
  }
private HttpResponse executeUploadInitiation ( GenericUrl initiationRequestUrl ) throws IOException { updateStateAndNotifyListener ( UploadState . INITIATION_STARTED ) ; initiationRequestUrl . put ( "uploadType" , "resumable" ) ; HttpContent content = metadata == null ? new EmptyContent ( ) : metadata ; HttpRequest request = requestFactory . buildRequest ( initiationRequestMethod , initiationRequestUrl , content ) ; initiationHeaders . set ( CONTENT_TYPE_HEADER , mediaContent . getType ( ) ) ; if ( isMediaLengthKnown ( ) ) { initiationHeaders . set ( CONTENT_LENGTH_HEADER , getMediaContentLength ( ) ) ; } request . getHeaders ( ) . putAll ( initiationHeaders ) ; HttpResponse response = executeCurrentRequest ( request ) ; boolean notificationCompleted = false ; try { updateStateAndNotifyListener ( UploadState . INITIATION_COMPLETE ) ; notificationCompleted = true ; } finally { if ( ! notificationCompleted ) { response . disconnect ( ) ; } } return response ; }
This method sends a POST request with empty content to get the unique upload URL.

@param initiationRequestUrl The request URL where the initiation request will be sent