users@jersey.java.net

[Jersey] Re: Client and custom socket factory

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Thu, 27 Jan 2011 11:00:54 +0100

Hello,

we don't have anything which could directly specify sockets and/or level
properties, we are using HttpURLConnection.

What could be acceptable is use HttpURLConnectionFactory [1] and manage
your own pool of connections (and somehow reuse your sockets to create
HttpURLConnection). I'm not sure whether you can create
HttpURLConnection with provided socket instance, but you might give it a
try/investigate about that.

Another option would be using Apache HTTP Client with
ManagedClientConnection [2].

Regards,
Pavel

[1]
http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/client/urlconnection/HttpURLConnectionFactory.html

[2]
http://hc.apache.org/httpcomponents-client-dev/httpclient/apidocs/org/apache/http/conn/ManagedClientConnection.html


On 01/26/2011 08:35 PM, Christopher Piggott wrote:
> I need to start a jersey client with the sockets coming from a
> specific local address. Is there a simple way to take my client and
> attach it to a socket factory (as a provider) or something like that?
> I can't figure it out from the documentation...
>
> --C
>
>