hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Claassen <mclaas...@ocie.net>
Subject SocketFactoryWrapper
Date Mon, 18 Sep 2006 14:58:20 GMT
I asked a question on this or the user list some time ago that didn't get
resolved.  I let it go for a while and when I came back to it I found the
answer immediately.  However, since no one was able to answer my question
before, I though I should share it with you in case it has any value for
anyone else.

Java WebStart is able to use the browser's ssl keystore and give that
information to the HttpsURLConnection.  So, say if a company is using
smartcards for SSL authentication, code using HttpsURLConnection will just
work out of the box.  HttpClient will not.

The socket factories implemented in HttpClient do not use webstart's.  This
was causing a roadblock for me in adopting HttpClient in our product
(although everything else about it was far superior).

I was struggling with this for a while and then the obvious answer came to
me, just get the SocketFactory from
HttpsURLConnection.getDefaultSocketFactory() and wrap it in
SecureProtocolSocketFactory.  My initial tests shows this work perfectly.
(And much appreciation to whoever designed the ProtocolSocketFactory
interfaces to be just like the java.net stuff!)

I didn't know if this is something that others are struggling with, or even
if something like this simple class should be included in the API.  With
smartcards and such getting more prevelant, I see this becoming more and
more of an issue as time goes by.  

(One of these method implementations comes from


View raw message