hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory Orton" <greg...@ctrl-z.me>
Subject Issue: cannot get httpclient working in netbeans
Date Fri, 09 Mar 2012 14:15:29 GMT
Hi there,

 

I have been working on a piece of software in Netbeans for a while,
successfully using the JDK built in library "HttpUrlConnection". However,
for various reasons when I try to use HttpClient in my software, I am
running into constant issues.

 

I download the both the *.jar files and the source code from the
hc.apache.org website and in netbeans I loaded the JAR files into my
libraries. Following this, I followed the tuotorial for a "basic" request in
my code and at the top of the document "import org.apache.http.client.*;"

 

Unfortunately with the example code:

 

HttpClient httpclient = new DefaultHttpClient();

HttpGet httpget = new HttpGet("http://localhost/");

HttpResponse response = httpclient.execute(httpget);

 

Netbeans starts complaining about several things:

 

1.     It says that HttpClient and DefaultHttpClient are incompatible types
and so I cannot assign one to another.

2.     So if I set HttpClient to be DefaultHttpClient then I get another
error and it decides that httpclient has no .execute() method defined for
it.

3.     If I cast (HttpClient) to from Default in the first assignation, I
can bypass this, but then the system rejects my call of execute() saying
that the httpget is not a valid property to pass to the execute command.

 

There is obviously some very strange behaviour going on here - it's clearly
my netbeans set-up or I am missing something pretty serious in my importing
of these files. Will httpclient work without Maven and importing everything
it needs? I really need some help getting httpclient into my netbeans
project. I've done so much reading and asking around on places like stack
overflow, but I honestly am at the end of my tether.

 

Any help you can offer would be appreciated.

 

Kind regards,

 

Gregory

 

 

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message