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