Groovy 监控 HttpClient 上传进度

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

/**
 * A utility that contains all of the client functionality needed to perform the upload tasks.  
 * This class is observable on the upload progress.
 *
 * @author Brock Heinz
 */
class ClientUtility extends Observable {

  /**
   * Wrapper around observable
   *
   * @param totalBytesWritten - number of bytes written to a stream to the server
   */
  void fireUploadProgress(int totalBytesWritten) {
    setChanged()
    notifyObservers(totalBytesWritten)
  }

  def doUpload(File f) {
    ...
  }
}