[armedbear-devel] java interop question

David Kirkman 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")

-david k.

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
> "org.apache.http.impl.client.DefaultHttpClient"))
>          (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
> http://hc.apache.org/httpcomponents-client-4.0.3/tutorial/html/fundamentals.html:
>
> 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.
> (http://hc.apache.org/httpcomponents-client-4.0.3/httpclient/apidocs/index.html).
>
> Thanks for any insight!
>
> -Kevin
>
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
>




More information about the armedbear-devel mailing list