Reputation: 21
Hi guys:
There are several methods such as HttpGet
and HttpPost
in this package. But the CONNECT method is lost. Do you know why ? I've tried to add my own HTTP CONNECT method following the HttpGet
method implementation. i.e. new the class HttpConnect which extends the HttpEntityEnclosingRequestBase base class. But this does not work. :-(
May you please help? Thank you!
Upvotes: 2
Views: 223
Reputation: 43088
You do not have to implement any connect method. Check out the example provided in official documentation:
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://localhost/");
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
int l;
byte[] tmp = new byte[2048];
while ((l = instream.read(tmp)) != -1) {
}
}
Refer to sources and documentation.
Upvotes: 2