FileDocCategorySizeDatePackage
CustomSocketFactory.javaAPI DocGlassfish v2 API5361Fri Jul 27 09:58:40 BST 2007com.sun.enterprise.security.auth.realm.ldap

CustomSocketFactory

public class CustomSocketFactory extends SocketFactory implements Comparator
Custom socket factory for ldaps (SSL). The comparator only works in JDK 1.6 onwards. Due to a bug in JDK 1.6 compare method invocation fails with a classcast exception. The caller is trying to pass java.lang.String when it should have passed javax.net.SocketFactory
see
com.sun.enterprise.security.auth.realm.ldap.LDAPRealm

Fields Summary
private static SocketFactory
socketFactory
public static final String
SSL
protected static final Logger
_logger
protected static final com.sun.enterprise.util.i18n.StringManager
sm
Constructors Summary
Methods Summary
public intcompare(javax.net.SocketFactory s1, javax.net.SocketFactory s2)

        return s1.getClass().toString().compareTo(s2.getClass().toString());
    
public java.net.SocketcreateSocket(java.lang.String arg0, int arg1)

see
javax.net.SocketFactory#createSocket(java.lang.String, int)

        return socketFactory.createSocket(arg0, arg1);
    
public java.net.SocketcreateSocket(java.net.InetAddress arg0, int arg1)

see
javax.net.SocketFactory#createSocket(java.net.InetAddress, int)

        return socketFactory.createSocket(arg0, arg1);
    
public java.net.SocketcreateSocket(java.lang.String arg0, int arg1, java.net.InetAddress arg2, int arg3)

see
javax.net.SocketFactory#createSocket(java.lang.String, int, java.net.InetAddress, int)

        return socketFactory.createSocket(arg0, arg1, arg2, arg3);
    
public java.net.SocketcreateSocket(java.net.InetAddress arg0, int arg1, java.net.InetAddress arg2, int arg3)

see
javax.net.SocketFactory#createSocket(java.net.InetAddress, int, java.net.InetAddress, int)

        return socketFactory.createSocket(arg0, arg1, arg2, arg3);
    
public static javax.net.SocketFactorygetDefault()

see
javax.net.SocketFactory#getDefault()

    
     
        SSLContext sc = null;
        try {
            sc = SSLContext.getInstance(SSL);
            sc.init(SSLUtils.getKeyManagers(), SSLUtils.getTrustManagers(), new java.security.SecureRandom());
        } catch (Exception ex) {
            _logger.log(Level.WARNING, "security.exception", ex);
        }        
        socketFactory = sc.getSocketFactory();
    
        return new CustomSocketFactory();