Creates an extended response object that corresponds to the
LDAP StartTLS extended request.
The result must be a concrete subclass of StartTlsResponse
and must have a public zero-argument constructor.
This method locates the implementation class by locating
configuration files that have the name:
META-INF/services/javax.naming.ldap.StartTlsResponse
The configuration files and their corresponding implementation classes must
be accessible to the calling thread's context class loader.
Each configuration file should contain a list of fully-qualified class
names, one per line. Space and tab characters surrounding each name, as
well as blank lines, are ignored. The comment character is '#'
(0x23); on each line all characters following the first comment
character are ignored. The file must be encoded in UTF-8.
This method will return an instance of the first implementation
class that it is able to load and instantiate successfully from
the list of class names collected from the configuration files.
This method uses the calling thread's context classloader to find the
configuration files and to load the implementation class.
If no class can be found in this way, this method will use
an implementation-specific way to locate an implementation.
If none is found, a NamingException is thrown.
// Confirm that the object identifier is correct
if ((id != null) && (!id.equals(OID))) {
throw new ConfigurationException(
"Start TLS received the following response instead of " +
OID + ": " + id);
}
StartTlsResponse resp = null;
Iterator ps = Service.providers(StartTlsResponse.class,
getContextClassLoader());
while (resp == null && privilegedHasNext(ps)) {
resp = (StartTlsResponse)ps.next();
}
if (resp != null) {
return resp;
}
try {
VersionHelper helper = VersionHelper.getVersionHelper();
Class clas = helper.loadClass(
"com.sun.jndi.ldap.ext.StartTlsResponseImpl");
resp = (StartTlsResponse) clas.newInstance();
} catch (IllegalAccessException e) {
throw wrapException(e);
} catch (InstantiationException e) {
throw wrapException(e);
} catch (ClassNotFoundException e) {
throw wrapException(e);
}
return resp;