org.apache.commons.httpclient.contrib.ssl
Class EasySSLProtocolSocketFactory

java.lang.Object
  extended byjavax.net.SocketFactory
      extended byjavax.net.ssl.SSLSocketFactory
          extended byorg.apache.commons.ssl.SSLClient
              extended byorg.apache.commons.ssl.HttpSecureProtocol
                  extended byorg.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory
All Implemented Interfaces:
ProtocolSocketFactory, SecureProtocolSocketFactory

public class EasySSLProtocolSocketFactory
extends HttpSecureProtocol

EasySSLProtocolSocketFactory can be used to creats SSL Sockets that accept self-signed certificates.

This socket factory SHOULD NOT be used for productive systems due to security reasons, unless it is a concious decision and you are perfectly aware of security implications of accepting self-signed certificates

Example of using custom protocol socket factory for a specific host:

     Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
 

HttpClient client = new HttpClient(); client.getHostConfiguration().setHost("localhost", 443, easyhttps); // use relative url only GetMethod httpget = new GetMethod("/"); client.executeMethod(httpget);

Example of using custom protocol socket factory per default instead of the standard one:

     Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
     Protocol.registerProtocol("https", easyhttps);
 

HttpClient client = new HttpClient(); GetMethod httpget = new GetMethod("https://localhost/"); client.executeMethod(httpget);

Author:
Oleg Kalnichevski

DISCLAIMER: HttpClient developers DO NOT actively support this component. The component is provided as a reference material, which may be inappropriate for use without additional customization.


Field Summary
 
Fields inherited from class org.apache.commons.ssl.SSLClient
 
Fields inherited from class javax.net.ssl.SSLSocketFactory
 
Constructor Summary
EasySSLProtocolSocketFactory()
          Constructor for EasySSLProtocolSocketFactory.
 
Methods inherited from class org.apache.commons.ssl.HttpSecureProtocol
createSocket
 
Methods inherited from class org.apache.commons.ssl.SSLClient
addTrustMaterial, createSocket, createSocket, createSocket, createSocket, createSocket, createSocket, createSocket, getAssociatedCertificateChain, getCheckCRL, getCheckExpiry, getCheckHostname, getConnectTimeout, getCurrentServerChain, getDefaultCipherSuites, getDefaultProtocol, getEnabledCiphers, getEnabledProtocols, getHostnameVerifier, getNeedClientAuth, getSoTimeout, getSSLContext, getSSLWrapperFactory, getSupportedCipherSuites, getTrustChain, getUseClientMode, getWantClientAuth, isSecure, setCheckCRL, setCheckExpiry, setCheckHostname, setConnectTimeout, setDefaultProtocol, setDnsOverride, setEnabledCiphers, setEnabledProtocols, setHostnameVerifier, setIsSecure, setKeyMaterial, setNeedClientAuth, setSoTimeout, setSSLWrapperFactory, setTrustMaterial, setUseClientMode, setWantClientAuth, useDefaultJavaCiphers, useStrongCiphers
 
Methods inherited from class javax.net.ssl.SSLSocketFactory
getDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory
createSocket
 
Methods inherited from interface org.apache.commons.httpclient.protocol.ProtocolSocketFactory
createSocket, createSocket
 

Constructor Detail

EasySSLProtocolSocketFactory

public EasySSLProtocolSocketFactory()
                             throws GeneralSecurityException,
                                    IOException
Constructor for EasySSLProtocolSocketFactory.

Throws:
GeneralSecurityException - GeneralSecurityException
IOException - IOException