1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport.http; |
8 | |
|
9 | |
import org.mule.model.streaming.DelegatingInputStream; |
10 | |
|
11 | |
import java.io.IOException; |
12 | |
import java.io.InputStream; |
13 | |
|
14 | |
import org.apache.commons.httpclient.HttpMethod; |
15 | |
|
16 | |
public class ReleasingInputStream extends DelegatingInputStream |
17 | |
{ |
18 | |
private final HttpMethod method; |
19 | |
|
20 | |
public ReleasingInputStream(InputStream is, HttpMethod method) |
21 | |
{ |
22 | 0 | super(is); |
23 | |
|
24 | 0 | this.method = method; |
25 | 0 | } |
26 | |
|
27 | |
public void close() throws IOException |
28 | |
{ |
29 | 0 | super.close(); |
30 | |
|
31 | 0 | if (method != null) |
32 | |
{ |
33 | 0 | method.releaseConnection(); |
34 | |
} |
35 | 0 | } |
36 | |
} |
37 | |
|