Hi Troy,

Here is an example:

        Client client = new Client(Protocol.HTTP);
        client.setConnectTimeout(5000);
        client.get(...);

After checking the code again, I realized that the internal HTTP client was not 
taking properly into account this property. This is fixed in Restlet 1.1 branch 
and SVN trunk.

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


-----Message d'origine-----
De : troy [mailto:troycau...@gmail.com] 
Envoyé : mercredi 14 octobre 2009 18:41
À : discuss@restlet.tigris.org
Objet : Re: Client Timeout on ClientResource post method

Could someone point me to the 1.1 technique referred to here?

-troy

On Fri, Oct 2, 2009 at 9:24 AM, Jerome Louvel <jerome.lou...@noelios.com> wrote:
> 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
> Noelios Technologies ~ Co-founder ~ 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=2407639

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

Reply via email to