Hi Rahul,

 

If your client resources are contained in a Restlet component, you could
just configure the HTTP client connector as you were doing in 1.1.
Otherwise, you need to provide the configured Client to your resource:

 

Client client = new Client(Protocol.HTTP);

client.setConnectTimeout(xxx);

ClientResource cr = new ClientResource(“http://www...”);

cr.setNext(client);

cr.get();

 

 

You can factorize this code in a custom ClientResource subclass if needed.

 

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~  <http://www.restlet.org/>
http://www.restlet.org
Noelios Technologies ~ Co-founder ~  <http://www.noelios.com/>
http://www.noelios.com

 

 

 

 

De : Rahul Juneja [mailto:rahul.jun...@thoughtclicks.com] 
Envoyé : lundi 21 septembre 2009 21:37
À : discuss@restlet.tigris.org
Objet : Client Timeout on ClientResource post method

 

I am using Restlet 2.0m4 and have created the ClientResource object as
follows.

ClientResource requestResource = new
ClientResource("http://localhost:8080/thoughtclicks/requestedResource";);
Representation reply = requestResource.post(rep); //client call

I want to set the timeout on the method, by this i mean if server resource
doesn't reply in specified time then i would like to terminate the call. and
do the next stuff.

In the previous version Restlet had a Client class which had this method to
set timeout, but when using ClientResource what should i do to set the
timeout ?

Thanks,
Rahul

-- 
Rahul Juneja
http://techlabs.thoughtclicks.com
http://finance.thoughtclicks.com
---------------------------------------------------------------------------
The thing always happens that you really believe in;
and the belief in a thing makes it happen.

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

Reply via email to