1 /* 2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/AbortableHttpRequest.java $ 3 * $Revision: 639600 $ 4 * $Date: 2008-03-21 04:28:15 -0700 (Fri, 21 Mar 2008) $ 5 * 6 * ==================================================================== 7 * Licensed to the Apache Software Foundation (ASF) under one 8 * or more contributor license agreements. See the NOTICE file 9 * distributed with this work for additional information 10 * regarding copyright ownership. The ASF licenses this file 11 * to you under the Apache License, Version 2.0 (the 12 * "License"); you may not use this file except in compliance 13 * with the License. You may obtain a copy of the License at 14 * 15 * http://www.apache.org/licenses/LICENSE-2.0 16 * 17 * Unless required by applicable law or agreed to in writing, 18 * software distributed under the License is distributed on an 19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 * KIND, either express or implied. See the License for the 21 * specific language governing permissions and limitations 22 * under the License. 23 * ==================================================================== 24 * 25 * This software consists of voluntary contributions made by many 26 * individuals on behalf of the Apache Software Foundation. For more 27 * information on the Apache Software Foundation, please see 28 * <http://www.apache.org/>. 29 * 30 */ 31 32 package org.apache.http.client.methods; 33 34 import java.io.IOException; 35 36 import org.apache.http.client.HttpClient; 37 import org.apache.http.conn.ClientConnectionManager; 38 import org.apache.http.conn.ClientConnectionRequest; 39 import org.apache.http.conn.ConnectionReleaseTrigger; 40 import org.apache.http.conn.ManagedClientConnection; 41 import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; 42 43 /** 44 * Interface representing an HTTP request that can be aborted by shutting 45 * down the underlying HTTP connection. 46 * 47 * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a> 48 * 49 * <!-- empty lines to avoid svn diff problems --> 50 * @version $Revision: 639600 $ 51 * 52 * @since 4.0 53 * 54 * @deprecated Please use {@link java.net.URL#openConnection} instead. 55 * Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a> 56 * for further details. 57 */ 58 @Deprecated 59 public interface AbortableHttpRequest { 60 61 /** 62 * Sets the {@link ClientConnectionRequest} callback that can be 63 * used to abort a long-lived request for a connection. 64 * If the request is already aborted, throws an {@link IOException}. 65 * 66 * @see ClientConnectionManager 67 * @see ThreadSafeClientConnManager 68 */ setConnectionRequest(ClientConnectionRequest connRequest)69 void setConnectionRequest(ClientConnectionRequest connRequest) throws IOException; 70 71 /** 72 * Sets the {@link ConnectionReleaseTrigger} callback that can 73 * be used to abort an active connection. 74 * Typically, this will be the {@link ManagedClientConnection} itself. 75 * If the request is already aborted, throws an {@link IOException}. 76 */ setReleaseTrigger(ConnectionReleaseTrigger releaseTrigger)77 void setReleaseTrigger(ConnectionReleaseTrigger releaseTrigger) throws IOException; 78 79 /** 80 * Aborts this http request. Any active execution of this method should 81 * return immediately. If the request has not started, it will abort after 82 * the next execution. Aborting this request will cause all subsequent 83 * executions with this request to fail. 84 * 85 * @see HttpClient#execute(HttpUriRequest) 86 * @see HttpClient#execute(org.apache.http.HttpHost, 87 * org.apache.http.HttpRequest) 88 * @see HttpClient#execute(HttpUriRequest, 89 * org.apache.http.protocol.HttpContext) 90 * @see HttpClient#execute(org.apache.http.HttpHost, 91 * org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext) 92 */ abort()93 void abort(); 94 95 } 96 97