// loads the deployment descriptors
Application app = loadDescriptors();
// Set the generated XML directory in application desc
request.getDescriptor().setGeneratedXMLDirectory(xmlDir.getAbsolutePath());
WebBundleDescriptor bundleDesc = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();
// The priority order of how the context root should be used:
// 1. Context root specified by user (via --contextRoot option
// or via gui), i.e. request.getContextRoot()
// 2. Context root specified in sun-web.xml i.e.
// bundleDesc.getContextRoot()
// 3. The default context root (archive name etc) i.e.
// req.getDefaultContextRoot()
if (request.getContextRoot() == null ||
request.getContextRoot().trim().equals("")) {
if (bundleDesc.getContextRoot() != null &&
!bundleDesc.getContextRoot().trim().equals("")) {
request.setContextRoot(bundleDesc.getContextRoot());
} else {
request.setContextRoot(request.getDefaultContextRoot());
}
}