Register / Login
Win a copy of
Kotlin in Action
this week in the
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
How to reusing org.restlet.resource.ClientResource
posted 4 years ago
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.
Don't get me started about those stupid
Boost this thread!
Rest based post for receiving and reponding with json
Restlet connection is not closing
RESTlet slower than Axis2?
Thread, Runnable and their run() method
SLSB Maximum Pool Size set to zero