Example usage for org.apache.http.client.methods AbstractExecutionAwareRequest abort

List of usage examples for org.apache.http.client.methods AbstractExecutionAwareRequest abort

Introduction

In this page you can find the example usage for org.apache.http.client.methods AbstractExecutionAwareRequest abort.

Prototype

public void abort() 

Source Link

Usage

From source file:com.liferay.mobile.android.http.file.FileTransferUtil.java

public static void transfer(AbstractExecutionAwareRequest request, InputStream is, OutputStream os,
        FileProgressCallback callback) throws IOException {

    int count;/* w  w w.j  a  v  a 2  s  .  c o  m*/
    byte data[] = new byte[4096];

    while (((count = is.read(data)) != -1) && !isCancelled(callback)) {
        os.write(data, 0, count);

        if (callback != null) {
            callback.increment(count);
        }
    }

    os.flush();

    if (isCancelled(callback)) {
        request.abort();
    }
}

From source file:org.archive.modules.fetcher.FetchHTTP.java

protected void doAbort(CrawlURI curi, AbstractExecutionAwareRequest request, String annotation) {
    curi.getAnnotations().add(annotation);
    curi.getRecorder().close();//w  w  w .  j  a  va 2  s.c om
    request.abort();
}