use of com.sun.enterprise.web.WebApplication in project Payara by payara.
the class AppServRegistry method getWebModule.
/*
* This function is called once for every endpoint registration.
* and the WebModule corresponding to that endpoint is stored.
*/
static WebModule getWebModule(WebServiceEndpoint wsep) {
ApplicationRegistry appRegistry = org.glassfish.internal.api.Globals.getDefaultHabitat().getService(ApplicationRegistry.class);
String appName = wsep.getBundleDescriptor().getApplication().getAppName();
ApplicationInfo appInfo = appRegistry.get(appName);
WebApplication webApp = null;
if (appInfo != null) {
Collection<ModuleInfo> moduleInfos = appInfo.getModuleInfos();
Set<EngineRef> engineRefs = null;
WebBundleDescriptor requiredWbd = (WebBundleDescriptor) wsep.getBundleDescriptor();
for (ModuleInfo moduleInfo : moduleInfos) {
engineRefs = moduleInfo.getEngineRefs();
for (EngineRef engineRef : engineRefs) {
if (engineRef.getApplicationContainer() instanceof WebApplication) {
webApp = (WebApplication) engineRef.getApplicationContainer();
WebBundleDescriptor wbd = webApp.getDescriptor();
if (wbd.equals(requiredWbd)) {
// WebApp corresponding to wsep is found.
break;
} else {
webApp = null;
}
}
}
}
}
// get the required WebModule from the webApp.
if (webApp != null) {
String requiredModule = ((WebBundleDescriptor) wsep.getBundleDescriptor()).getModuleName();
Set<WebModule> webModules = webApp.getWebModules();
for (WebModule wm : webModules) {
if (wm.getModuleName().equalsIgnoreCase(requiredModule)) {
return wm;
}
}
}
return null;
}
Aggregations