How are you building then, ant? Bill- On Mar 10, 2012 6:30 AM, "Gregory Orton" <[email protected]> wrote:
> I don't have a pom.xml file. Not least one I can find in the project path. > > -----Original Message----- > From: kim young ill [mailto:[email protected]] > Sent: 10 March 2012 19:13 > To: HttpClient User Discussion > Subject: Re: Issue: cannot get httpclient working in netbeans > > post your pom.xml file. > > > On Sat, Mar 10, 2012 at 9:56 AM, Gregory Orton <[email protected]> wrote: > > > Thanks for the titbit: > > > > Here's an update: > > > > I had to add > > > > import org.apache.http.client.methods.*; > > > > otherwise netbeans reports "cannot find symbol" for the "new HttpGet();" > > instantiation. > > > > I am however, still left with the same old error of > "cli.execute(method);". > > > > I have checked the javadocs and DefaultHttpClient is subclass of > > AbstractHttpClient, so surely it should inherit the methods and > > therefore execute?!? Right? Why does netbeans have an issue with this? > > > > Gregory > > > > -----Original Message----- > > From: David Motes [mailto:[email protected]] > > Sent: 09 March 2012 23:36 > > To: HttpClient User Discussion > > Subject: Re: Issue: cannot get httpclient working in netbeans > > > > Here are some lines of code that works with netbeans. note the imports > > > > import org.apache.http.Header; > > > > import org.apache.http.HttpResponse; > > > > import org.apache.http.auth.AuthScope; import > > org.apache.http.auth.UsernamePasswordCredentials; > > > > import org.apache.http.HttpEntity; > > import org.apache.http.HttpHost; > > import org.apache.http.impl.client.DefaultHttpClient; > > import org.apache.http.client.methods.HttpGet; > > import org.apache.http.impl.conn.ProxySelectorRoutePlanner; > > import org.apache.http.conn.params.ConnRoutePNames; > > > > ***SNIP > > > > HttpGet method = null; > > HttpHost targetHost = null; > > HttpHost proxy = null; > > DefaultHttpClient cli = new DefaultHttpClient(); > > > > method = new HttpGet(url); > > > > HttpResponse resp = null; > > HttpEntity ent = null; > > > > resp = cli.execute(method); > > > > ent = resp.getEntity(); > > > > On Fri, Mar 9, 2012 at 9:15 AM, Gregory Orton <[email protected]> wrote: > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
