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 super(is);
23
24 this.method = method;
25 }
26
27 public void close() throws IOException
28 {
29 super.close();
30
31 if (method != null)
32 {
33 method.releaseConnection();
34 }
35 }
36 }
37