users@jersey.java.net

Re: [Jersey] Jersey-client and connection: keep-alive

From: Jan Algermissen <algermissen1971_at_mac.com>
Date: Sun, 17 Oct 2010 19:51:42 +0200

On Oct 17, 2010, at 5:05 PM, Jan Algermissen wrote:

> Matt,
>
> Jersey supports the use of Apache HTTP Client internally.
>
> apidocs:
> https://jersey.dev.java.net/nonav/apidocs/1.4/contribs/jersey-apache-client/index.html
>
> Not sure how you set up Apache HTTP client for persistant connections, though.
>

As far as I see you can access the HttpClient through ApacheHttpClientHandler.getHttpClient().

You should then be able to set the keep alive strategy as described in

http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e645

(which you probably do already in your Apache client use).

HTH,

Jan



> Jan
>
>
> On Oct 16, 2010, at 8:38 PM, Matthew Cordes wrote:
>
>> Hi guys,
>>
>> Can someone tell me if the Jersey Client class supports persistent http connections (using the "Connection: keep-alive" header)? If so, how would I enable this?
>>
>> For my usecase I need to send and receive multiple requests/responses via HTTP over a single connection. I've got it working with Apache's HTTPClient, but I'd much rather use Jersey Client if I can.
>>
>> Any thoughts?
>>
>> -Matt
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>