Hello ! Salut les gars !

I am currently trying to do a nice mix : GAE on server side, GWT and Android 
for the client side, with users authenticated using their Google Accounts.

So far so good, I've been able to use GAE / GWT with Restlet, as well as to 
authenticate on GAE from Android with a Google Account.

To authenticate my requests, all I need to do is to add a cookie to the the 
request. Which I know how to do on an HttpClient.

Here is how I configure my Android client :

*********************
List<ConverterHelper> converters = 
Engine.getInstance().getRegisteredConverters();

converters.add(new JacksonConverter());

ClientResource clientResource = new ClientResource("https://XXX";);
TagResource tagRes = clientResource.wrap(TagResource.class);
********************

I am quite stuck here, since I use all the "magic" found in the docs, I'm 
definitely lost with the internals of Restlet, although I've really tried to go 
deep in the code / the docs .

I tried to build a HttpClientHelper, start it, get its HttpClient, cast it to 
DefaultHttpClient, and change the cookie store : didn't seem to work. BTW, 
HttpClientHelper needs a Client in its constructor, and I don't quite 
understand how this works.

Here is my solution :

********************
Client restClient = new Client(Arrays.asList(Protocol.HTTP, Protocol.HTTPS));

HttpClientHelper httpClientHelper = new HttpClientHelper(restClient);

httpClientHelper.start();

BasicCookieStore cookieStore = new BasicCookieStore();

cookieStore.addCookie(cookies[0]);

((DefaultHttpClient) 
httpClientHelper.getHttpClient()).setCookieStore(cookieStore);

Engine.getInstance().getRegisteredClients().add(httpClientHelper);
********************

I hope you'll be able to help me, and maybe guide me through the docs. I just 
met so many pages with "TODO"'s inside that I almost got mad...

Oh, and BTW : there is still a bug in the JacksonConverter, that throws an 
Exception when a method returns a void type (Jackson shouldn't have to convert 
anything in those cases).

Thanks, and best regards.

Piwaï

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2641943

Reply via email to