parentLoader = _serverContext.getSharedClassLoader();
}
ctx.setParentClassLoader(parentLoader);
Throwable exception = null;
Switch sw = Switch.getSwitch();
try{
// Determine if an alternate DD is set for this web-module in
// the application
if (wbd != null) {
String altDDName = wbd.getModuleDescriptor().
getAlternateDescriptor();
if (altDDName != null) {
// we should load the alt dd from generated/xml directory
// first, then fall back to original app location.
// if we have alt dd, it must be an embedded web module
String appName = wmName.substring(0,
wmName.indexOf(Constants.NAME_SEPARATOR));
String appLoc =
appsManager.getGeneratedXMLLocation(appName);
if (! FileUtils.safeIsDirectory(appLoc)) {
appLoc = wmInfo.getLocation()+"/..";
}
if (altDDName.startsWith("/")) {
altDDName = appLoc+altDDName.trim();
}
else {
altDDName = appLoc+"/"+altDDName.trim();
}
Object[] objs = {altDDName, wmName};
_logger.log(Level.INFO, "webcontainer.altDDName", objs);
ctx.setAltDDName(altDDName);
}
// time to update the Web Services related information in
// our runtime jsr77 mbeans. We publish two extra properties
// hasWebServices and endpointAddresses for webservices
// enable web applications.
if (wbd.hasWebServices()) {
ctx.setHasWebServices(true);
// creates the list of endpoint addresses
String[] endpointAddresses;
WebServicesDescriptor webService = wbd.getWebServices();
Vector endpointList = new Vector();
for (Iterator endpoints = webService.getEndpoints().iterator();
endpoints.hasNext();) {
WebServiceEndpoint wse = (WebServiceEndpoint) endpoints.next();
if (wbd.getContextRoot()!=null) {
endpointList.add(wbd.getContextRoot() + "/"
+ wse.getEndpointAddressUri());
} else {
endpointList.add(wse.getEndpointAddressUri());
}
}
endpointAddresses = new String[endpointList.size()];
endpointList.copyInto(endpointAddresses);
ctx.setEndpointAddresses(endpointAddresses);
} else {
ctx.setHasWebServices(false);
}
}
// Object containing sun-web.xml information
SunWebApp iasBean = null;
// The default context is the only case when wbd == null
if (wbd != null)
iasBean = wbd.getSunDescriptor();
// set the sun-web config bean
ctx.setIasWebAppConfigBean(iasBean);
ctx.setID(wmName);
// Configure SingleThreadedServletPools, work/tmp directory etc
configureMiscSettings(ctx, iasBean, vs, displayContextPath);
// Configure alternate docroots if dummy web module
if (Constants.DEFAULT_WEB_MODULE_NAME.equals(ctx.getID())) {
ctx.setAlternateDocBases(vs.getProperties());
}
// Configure the class loader delegation model, classpath etc
Loader loader = configureLoader(ctx, iasBean, wmInfo);
// Set the class loader on the DOL object
if (wbd != null && wbd.hasWebServices())
wbd.addExtraAttribute("WEBLOADER", loader);
// Enable dynamic reloading only for Web Modules
if ( wmInfo.getBean() instanceof
com.sun.enterprise.config.serverbeans.WebModule &&
_reloadingEnabled) {
if (_reloadManager == null) {
_reloadManager = new StandaloneWebModulesManager(
_id,
_modulesRoot,
_pollInterval);
}
_reloadManager.addWebModule((com.sun.enterprise.config.serverbeans.WebModule)wmInfo.getBean());
}
// Configure the session manager and other related settings
// HERCULES:mod - take into account if app is distributable
// passing in WebBundleDescriptor which has info about whether
// app is distributable
ctx.configureSessionSettings(wbd, wmInfo);
// END HERCULES:mod
// set i18n info from locale-charset-info tag in sun-web.xml
ctx.setI18nInfo();
if (wbd != null) {
String resourceType = null;
if(wmInfo.getBean() instanceof
com.sun.enterprise.config.serverbeans.WebModule) {
resourceType =
((com.sun.enterprise.config.serverbeans.WebModule)wmInfo.
getBean()).getObjectType();
} else {
resourceType = ((ExtensionModule)wmInfo.getBean()).
getObjectType();
}
boolean isSystem = (resourceType != null &&
resourceType.startsWith("system-"));
if ("null".equals(j2eeApplication)) {
/*
* Standalone webapps inherit the realm referenced by
* the virtual server on which they are being deployed,
* unless they specify their own
*/
ctx.setRealm(getRealmAdapter(wbd, isSystem, vs.getAuthRealmName()));
} else {
ctx.setRealm(getRealmAdapter(wbd, isSystem, null));
}
configureSecurity(wbd, isSystem);
sw.setDescriptorFor(ctx, wbd);
// post processing DOL object for standalone web module
if (wbd.getApplication() != null &&
wbd.getApplication().isVirtual()) {
wbd.visit((WebBundleVisitor) new WebValidatorWithoutCL());