I try to implement an progress while uploading an file with HttpClient
4.3.3 and MultipartEntityBuilder
So actually i execute a post reques
I just found a solution for that:
You need an HttpEntityWrapper
which counts the processed bytes and has a callback.
ProgressHttpEntityWrapper.ProgressCallback progressCallback = new ProgressHttpEntityWrapper.ProgressCallback() {
@Override
public void progress(float progress) {
//Use the progress
}
}
httpPost.setEntity(new ProgressHttpEntityWrapper(entityBuilder.build(), progressCallback));
And here is the complete code from the ProgressHttpEntityWrapper
: https://github.com/x2on/gradle-hockeyapp-plugin/blob/master/src/main/groovy/de/felixschulze/gradle/util/ProgressHttpEntityWrapper.groovy
Main source for this solution: https://stackoverflow.com/a/7319110/268795