Hi Nicolas,

Late answer... The page on the Apache HTTP Client extension is this one:
http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/75-restlet.html

As you can see in the linked Javadocs:
http://www.restlet.org/documentation/2.0/jse/ext/org/restlet/ext/httpclient/HttpClientHelper.html

there are various timeouts that can be set, however persistent connections 
can't be disabled. For connection timeout, this can be directly set via the 
Client#setConnectTimeout(int) method. The "socketTimeout" parameter is for 
reading/writing IO operations and "idleTimeout" is for persistent connections 
indeed.

Note that version 2.1 has a much improved internal connector with persistent 
and non-persistent connections support, see the parameters:
http://www.restlet.org/documentation/2.1/jee/engine/org/restlet/engine/connector/BaseHelper.html
http://www.restlet.org/documentation/2.1/jee/engine/org/restlet/engine/connector/ConnectionHelper.html
http://www.restlet.org/documentation/2.1/jee/engine/org/restlet/engine/connector/ClientConnectionHelper.html

Also, in 2.1 the Client#connectTimeout property has been deprecated as it is 
hard to find compared to other connector parameters. Also, it isn't available 
for all connectors so it can be confusing to expose it. Use the new 
"socketConnectTimeoutMs" connector parameter instead or the general 
"maxIoIdleTimeMs" parameter for internal NIO connectors.

Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.o​rg
Noelios Technologies ~ http://www.noelios.com



-----Message d'origine-----
De : Nicolas Rinaudo [mailto:[email protected]] 
Envoyé : mercredi 11 août 2010 10:59
À : [email protected]
Objet : Client configuration

I'm having issues configuring or understanding how to configure client 
connectors.

What I'm trying to do is:
 - disable persistant connections altogether.
 - set a specific timeout policy.

Note: this is for the Apache httpclient connector, I've not tried with others.

Connection Persistence:
The only documentation I could find was: 
http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet/324-restlet/130-restlet.html

According to this, it appears that setting the context property 
"clientKeepAlive" to a specific value will disable connection persistence. The 
necessary value isn't clear, so I've tried "close", "off", "no" and "false".

Whatever the configuration, the client's HTTP headers always contain a 
"Connection: Keep-Alive" entry.

Is there a way to disable connection persistence, at least for the Apache 
httpclient connector? If so, I'd be grateful for any help, I've struggled with 
this for a while and am no further than when I started.

Timeout handling
This is a documentation issue more than an implementation one. I'd like to set 
a timeout for both socket opening and content retrieval - a query shouldn't 
take more than x seconds to be established, nor should it take more than y 
seconds to complete. Note that in my specific case, setting x and y to the same 
value is perfectly acceptable.

Looking at the documentation 
(http://www.restlet.org/documentation/2.0/jse/ext/org/restlet/ext/httpclient/HttpClientHelper.html),
 I'm a bit confused.
- socketTimeout is probably the variable I want to set for connection 
establishment.
- I'm unsure what idleTimeout does. The documentation could describe both 
persistent connections timeout (if the connection hasn't been used for x ms, 
close it) or stalled connections. Either way, it doesn't look like what I'm 
looking for.

There are no other timeout related configuration variables that I can see in 
the documentation. Am I missing or misunderstanding something?

Thanks !

Nicolas

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

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

Reply via email to