I am currently using Restlet 2.1.2 on Android, and I'd like to know how to reuse the instance Clientresource in my application.
Here is the code I use:
Client client = new Client (new Context (), Protocol.HTTP);
ClientResource clientResource ClientResource = new ("http://codeblow.com/");
clientResource.setNext (client);
/ / Executors.newCachedThreadPool ExecutorService pool = ();
clientResource.get ();
clientResource.release ();
ClientResource clientResource1 ClientResource = new ("http://codeblow.com/");
clientResource.setNext (client);
"Starting the internal [HTTP/1.1] client" "Starting the internal [HTTP/1.1] client"
As you can see, at each new instantiate of ClientResource, it create new clients. I just want to keep 1 clientresource and then make few requests with the same instance to the server.
Whats is the best way to do that ?
Other point: I used the #setNext() method to keep the client, but i feel that's useless., because it create another client anyway.
Best regards