&&
(!IntrospectionUtil.isTypeCompatible(type, resource.type(), false)))
throw new IllegalStateException("@Resource incompatible type="+resource.type()+ " with method param="+type+ " for "+m);
//check if an injection has already been setup for this target by web.xml
Injection webXmlInjection = webXmlInjections.getInjection(getTargetClass(), m);
if (webXmlInjection == null)
{
try
{
//try binding name to environment
//try the webapp's environment first
boolean bound = org.mortbay.jetty.plus.naming.NamingEntryUtil.bindToENC(_webApp, name, mappedName);
//try the server's environment
if (!bound)
bound = org.mortbay.jetty.plus.naming.NamingEntryUtil.bindToENC(_webApp.getServer(), name, mappedName);
//try the jvm's environment
if (!bound)
bound = org.mortbay.jetty.plus.naming.NamingEntryUtil.bindToENC(null, name, mappedName);
//TODO if it is an env-entry from web.xml it can be injected, in which case there will be no
//NamingEntry, just a value bound in java:comp/env
if (!bound)
{
try
{
InitialContext ic = new InitialContext();
String nameInEnvironment = (mappedName!=null?mappedName:name);
ic.lookup("java:comp/env/"+nameInEnvironment);
bound = true;
}
catch (NameNotFoundException e)
{
bound = false;
}
}
if (bound)
{
Log.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name);
// Make the Injection for it
Injection injection = new Injection();
injection.setTargetClass(getTargetClass());
injection.setJndiName(name);
injection.setMappingName(mappedName);
injection.setTarget(m);
webXmlInjections.add(injection);
}
else if (!isEnvEntryType(type))
{