if(applicationArchive.contains(APPLICATION_XML_PATH))
{
ApplicationDescriptor applicationXml = Descriptors.importAs(ApplicationDescriptor.class).from(
applicationArchive.get(APPLICATION_XML_PATH).getAsset().openStream());
applicationXml.webModule(wrappedWar.getName(), ServletUtil.calculateContextRoot(wrappedWar.getName()));
// SHRINKWRAP-187, to eager on not allowing overrides, delete it first
applicationArchive.delete(APPLICATION_XML_PATH);
applicationArchive.setApplicationXML(
new StringAsset(applicationXml.exportAsString()));