Java: stopping long HTTP operations

Posted by kilonet on Stack Overflow See other posts from Stack Overflow or by kilonet
Published on 2010-05-28T08:27:53Z Indexed on 2010/05/28 8:31 UTC
Read the original article Hit count: 212

Filed under:
|
|

I'm using Apache Common library for HTTP operations:

HttpClient client = getClient();
PutMethod put = new PutMethod(url);
FileRequestEntity countingFileRequestEntity = new FileRequestEntity(file, "application/octet-stream");
put.setRequestEntity(countingFileRequestEntity);
client.executeMethod(put);
put.releaseConnection();

I wonder how can safely interrup long HTTP operation. Running it in new thread and stopping it seems to be wrong way. HttpMethodBase has abort() method, but I can't understand how to use it because client.executeMethod blocks execution until it complets

© Stack Overflow or respective owner

Related posts about java

Related posts about http