users@jersey.java.net

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

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 27 Oct 2010 11:50:11 +0200

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?
>

In addition to what Jan says the default use of HttpURLConnecton
supports Keep-Alive by default.

See here:

   http://download.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html

The problem with HttpURLConnecton is the poor control over
configuration, especially in server-side environments.

Paul.