[armedbear-devel] java interop question
dkirkman at ucsd.edu
Tue Oct 12 20:18:40 UTC 2010
I don't have httpcomponents, so this is not tested ...
But your problem is probably that (jmethod client-class "execute") is
looking for a zero argument execute method, and the class does not
have one. Based on the api docs (and your attempted method call), I
think you want
(jmethod client-class "execute" "org.apache.http.client.methods.HttpUriRequest")
On Tue, Oct 12, 2010 at 1:01 PM, Kevin Raison <raison at chatsubo.net> wrote:
> I am an old hand at cl, but java is still a bit of a mystery to me. I
> am particularly puzzled as to why, when trying to use the apache http
> components library to do a simple http get in abcl, I cannot make it
> work. My code:
> (defun http-get (url)
> (let* ((url (jnew (jclass "java.lang.String") url))
> (client-class (jclass
> (client-obj (jnew client-class))
> (get-class (jclass "org.apache.http.client.methods.HttpGet"))
> (get-obj (jnew get-class url)))
> (jcall (jmethod client-class "execute") client-obj get-obj)))
> And the java code from the apache tutorial
> HttpClient httpclient = new DefaultHttpClient();
> HttpGet httpget = new HttpGet("http://localhost/");
> HttpResponse response = httpclient.execute(httpget);
> For some reason, my code fails with
> No such method: org.apache.http.impl.client.DefaultHttpClient.execute().
> I do have the appropriate jars in my class path.
> The java code specifically calls the execute method on its instantiated
> httpclient, but I cannot do the same from abcl. This method is
> inherited from org.apache.http.impl.client.AbstractHttpClient, in case
> that makes a difference.
> Thanks for any insight!
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
More information about the armedbear-devel