Revision b347d5e3 src/com/rackspace/cloud/files/api/client/ContainerManager.java
b/src/com/rackspace/cloud/files/api/client/ContainerManager.java | ||
---|---|---|
16 | 16 |
import org.apache.http.client.methods.HttpPost; |
17 | 17 |
import org.apache.http.client.methods.HttpPut; |
18 | 18 |
import org.apache.http.impl.client.BasicResponseHandler; |
19 |
import org.apache.http.impl.client.DefaultHttpClient; |
|
20 | 19 |
import org.apache.http.protocol.RequestExpectContinue; |
21 | 20 |
import org.xml.sax.InputSource; |
22 | 21 |
import org.xml.sax.SAXException; |
23 | 22 |
import org.xml.sax.XMLReader; |
24 | 23 |
|
24 |
import android.content.Context; |
|
25 | 25 |
import android.text.Editable; |
26 | 26 |
import android.util.Log; |
27 | 27 |
|
... | ... | |
36 | 36 |
* |
37 | 37 |
*/ |
38 | 38 |
public class ContainerManager extends EntityManager { |
39 |
private Context context; |
|
40 |
|
|
41 |
public ContainerManager(Context context) { |
|
42 |
this.context = context; |
|
43 |
} |
|
39 | 44 |
|
40 | 45 |
public HttpResponse create(Editable editable) throws CloudServersException { |
41 | 46 |
HttpResponse resp = null; |
42 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
|
47 |
CustomHttpClient httpclient = new CustomHttpClient(context);
|
|
43 | 48 |
HttpPut put = new HttpPut(Account.getStorageUrl() + "/" + editable); |
44 | 49 |
|
45 | 50 |
put.addHeader("X-Auth-Token", Account.getAuthToken()); |
... | ... | |
65 | 70 |
|
66 | 71 |
public ArrayList<Container> createCDNList(boolean detail) throws CloudServersException { |
67 | 72 |
|
68 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
|
73 |
CustomHttpClient httpclient = new CustomHttpClient(context);
|
|
69 | 74 |
HttpGet get = new HttpGet(Account.getCdnManagementUrl()+"?format=xml"); |
70 | 75 |
ArrayList<Container> cdnContainers = new ArrayList<Container>(); |
71 | 76 |
|
... | ... | |
123 | 128 |
public HttpResponse enable(String container, String ttl, String logRet) |
124 | 129 |
throws CloudServersException { |
125 | 130 |
HttpResponse resp = null; |
126 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
|
131 |
CustomHttpClient httpclient = new CustomHttpClient(context);
|
|
127 | 132 |
HttpPut put = new HttpPut(Account.getCdnManagementUrl() + "/" |
128 | 133 |
+ container); |
129 | 134 |
|
... | ... | |
153 | 158 |
public HttpResponse disable(String container, String cdn, String ttl, String logRet) |
154 | 159 |
throws CloudServersException { |
155 | 160 |
HttpResponse resp = null; |
156 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
|
161 |
CustomHttpClient httpclient = new CustomHttpClient(context);
|
|
157 | 162 |
HttpPost post = new HttpPost(Account.getCdnManagementUrl() + "/" |
158 | 163 |
+ container); |
159 | 164 |
|
... | ... | |
183 | 188 |
|
184 | 189 |
public HttpResponse delete(String string) throws CloudServersException { |
185 | 190 |
HttpResponse resp = null; |
186 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
|
191 |
CustomHttpClient httpclient = new CustomHttpClient(context);
|
|
187 | 192 |
HttpDelete put = new HttpDelete(Account.getStorageUrl() + "/" + string); |
188 | 193 |
|
189 | 194 |
put.addHeader("X-Auth-Token", Account.getAuthToken()); |
... | ... | |
210 | 215 |
public ArrayList<Container> createList(boolean detail) |
211 | 216 |
throws CloudServersException { |
212 | 217 |
|
213 |
DefaultHttpClient httpclient = new DefaultHttpClient();
|
|
218 |
CustomHttpClient httpclient = new CustomHttpClient(context);
|
|
214 | 219 |
HttpGet get = new HttpGet(Account.getStorageUrl() + "?format=xml"); |
215 | 220 |
ArrayList<Container> containers = new ArrayList<Container>(); |
216 | 221 |
|
Also available in: Unified diff