users@jersey.java.net

[Jersey] Re: Problems with Jersey 1.10 and Android 2.3.3

From: Ricardo Borillo Doménech <ricardo.borillo_at_si.uji.es>
Date: Tue, 6 Dec 2011 11:20:29 +0100

Hi Pavel,

Thanks for your comments.

If i use de type, the problem dissapear, but i get a new exception:

com.sun.jersey.api.client.ClientHandlerException: java.lang.NullPointerException
         at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)
         at com.sun.jersey.api.client.Client.handle(Client.java:648)
         at com.sun.jersey.api.client.WebResource.handle(WebResource.java:670)
         at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
        at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:503)

If i use directly the commons-httpclient included in Android, alll
works fine (HttpGet).
It seems like there's a compatibility problem between Jersey Client
1.10 and the commons-httpclient included in Android ...

Any ideas?

Best regards,
====================================
Ricardo Borillo Domenech
http://xml-utils.com / http://twitter.com/borillo



On 5 December 2011 15:18, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:
> Hi Ricardo,
>
> looks like there is some problem with delegate to RI. You should be able to
> workaround that by using MediaType.APPLICATION_XML_TYPE instead of
> MediaType.APPLICATION_XML.
>
> Let me know if it works for you.
>
> Regards,
> Pavel
>
> On 12/4/11 6:47 PM, Ricardo Borillo wrote:
>>
>> Hi all,
>>
>> I have read that it is possible to use Jersey Client in Adroid, but
>> i'm facing some issues ...
>>
>> I try to call a remote REST service:
>>
>>        Client client = Client.create();
>>        WebResource resource =
>> client.resource("http://xxxxxx").path("yyyyy");
>>        ClientResponse response =
>> resource.accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
>>        Document document = response.getEntity(Document.class);
>>
>> But i'm getting a NullPointException at
>> javax.ws.rs.core.MediaType.valueOf(MediaTYpe.java:119).
>>
>> Any known problem with Jersey and Android?
>>
>> Best regards,
>> ====================================
>> Ricardo Borillo Domenech
>> http://xml-utils.com / http://twitter.com/borillo
>>
>