简体   繁体   中英

org.apache.http.client.httpclient is abstract cannot be instantiated

Im trying to use apache HttpClient 4.1.2 but the debugger shows

org.apache.http.client.httpclient is abstract; cannot be instantiated

when I do:

HttpClient client = new HttpClient();

Any idea on how to use it then ?

Thx

Stephane

You have to find an actual implementation for that class. Abstract classes can never be directly initiated.

The javadoc knows 3 implementing classes you can use DefaultHttpClient and ContentEncodingHttpClient .

The javadoc even has a short sample on that topic.

使用一种具体的实现。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM