DefaultActionInvocation inv = new DefaultActionInvocation(extraContext,
true);
container.inject(inv);
// 将Bundle的ClassLoader注入到inv的objectFactory中
try {
ObjectFactory objectFactory = (ObjectFactory) FieldUtils.readField(
inv, "objectFactory", true);
@SuppressWarnings("rawtypes")
Map requestMap = (Map) extraContext.get("request");
String pluginName = (String) requestMap
.get(WebContext.CONST_PLUGIN_NAME);
Bundle bundle = OsgiContext.getBundleByName(pluginName);
ClassLoader bundleClassLoader = BundleUtils
.getBundleClassLoader(bundle);
objectFactory.setClassLoader(bundleClassLoader);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
return createActionProxy(inv, namespace, actionName, methodName,
executeResult, cleanupContext);