code: public static String pathNameOfDeployment(final DeploymentUnit deploymentUnit, final JBossWebMetaData metaData) {
  		String pathName;
  		if (metaData.getContextRoot() == null) {
  			final EEModuleDescription description = deploymentUnit
  					.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
  			if (description != null) {
  				// if there is an EEModuleDescription we need to take into
  				// account that the module name may have been
  				// overridden
  				pathName = "/" + description.getModuleName();
  			} else {
  				pathName = "/" + deploymentUnit.getName().substring(0, deploymentUnit.getName().length() - 4);
  			}
  		} else {
  			pathName = metaData.getContextRoot();
  			if (pathName.length() > 0 && pathName.charAt(0) != '/') {
  				pathName = "/" + pathName;
  			}
  		}
  		return pathName;
  	}
docs: UndertowDeploymentProcessor.pathNameOfDeployment()