I'm new to restlet, and trying to understand which HTTPS client option I should be using with android. Which HTTPS client option is most robust and stable for Android? I'm using restlet 2.1rc4 (and 2.1.0), and android 2.2. Unfortunately, changing the android version is not an option for me.
I think the possibilities are:
- Apache HttpClient (org.restlet.ext.httpclient)
- .net client (org.restlet.ext.net)
- Restlet internal client
I've had some success with org.restlet.ext.net, it works most of the time but I get various exceptions with "Communication Error (1001) with messages like "broken pipe", and also many cases of immediate return from a client request with a status of "null (-1)" without ever sending a request to the server. Maybe this is caused by bugs in the old android we are using, but I'm not really sure.
I tried to use the Apache client, but can't get HTTPS to work at all because it gives this exception: java.lang.IllegalStateException: Scheme 'https' not registered. The same code works on Windows with the Jave SE edition of org.restlet.ext.net.jar, but when I use the Android version of that same jar file it says https is not registered. I thought the Apache client supported HTTPS on android, but it isn't working for me.
I also tried the internal client, but that doesn't work at all either. I get the same 1001 error problem as Android RESTLet SSL Null Pointer. I tried this with restlet 2.1.0 and android 2.2.
My source code is basically like this (showing attempt to use Apache client):
context = new org.restlet.Context();
Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());
Engine.getInstance().getRegisteredClients().add(new org.restlet.ext.httpclient.HttpClientHelper(null));
client = new org.restlet.Client(context, org.restlet.data.Protocol.HTTPS);
context.setClientDispatcher(client);
ClientResource resource = new ClientResource(context, url);
resource.setEntityBuffering(true);
PojoResult result = resource.post(new PojoRequest, PojoResult.class);