DeploymentUnit unit = phaseContext.getDeploymentUnit();
if (DeploymentUtils.isUnitRootless( unit )) {
return;
}
ResourceRoot resourceRoot = unit.getAttachment( Attachments.DEPLOYMENT_ROOT );
RackMetaData rackAppMetaData = unit.getAttachment( RackMetaData.ATTACHMENT_KEY );
RailsMetaData railsAppMetaData = unit.getAttachment( RailsMetaData.ATTACHMENT_KEY );
if (rackAppMetaData == null) {
return;
}
unit.addToAttachmentList( Attachments.RESOURCE_ROOTS, resourceRoot );
WarMetaData warMetaData = unit.getAttachment( WarMetaData.ATTACHMENT_KEY );
WebMetaData webMetaData = warMetaData.getWebMetaData();
if (webMetaData == null) {
webMetaData = new WebMetaData();
ServiceName jgroups = ChannelFactoryService.getServiceName( null );
if (phaseContext.getServiceRegistry().getService( jgroups ) != null) {
webMetaData.setDistributable( new EmptyMetaData() );
}
warMetaData.setWebMetaData( webMetaData );
}
Map<String, WebFragmentMetaData> webFragmentsMetaData = warMetaData.getWebFragmentsMetaData();
if (webFragmentsMetaData == null) {
webFragmentsMetaData = new HashMap<String, WebFragmentMetaData>();
warMetaData.setWebFragmentsMetaData( webFragmentsMetaData );
}
JBossWebMetaData jbossWebMetaData = warMetaData.getJBossWebMetaData();
if (jbossWebMetaData == null) {
jbossWebMetaData = new JBossWebMetaData();
warMetaData.setJBossWebMetaData( jbossWebMetaData );
}
setUpSessionConfig( jbossWebMetaData, rackAppMetaData );
setUpSendfileFilter( webMetaData );
setUpRackFilter( unit, rackAppMetaData, webMetaData );
setUpStaticResourceServlet( rackAppMetaData, webMetaData, railsAppMetaData != null );
ensureSomeServlet( rackAppMetaData, webMetaData );
try {
jbossWebMetaData.setContextRoot( rackAppMetaData.getContextPath() );
setUpPoolDependency( rackAppMetaData, jbossWebMetaData );
} catch (Exception e) {
throw new DeploymentUnitProcessingException( e );
}
jbossWebMetaData.setVirtualHosts( rackAppMetaData.getHosts() );
ServletContextAttribute serviceRegistryValue = new ServletContextAttribute( "service.registry", unit.getServiceRegistry() );
unit.addToAttachmentList( ServletContextAttribute.ATTACHMENT_KEY, serviceRegistryValue );
ServletContextAttribute componentResolverNameValue = new ServletContextAttribute( "component.resolver.service-name",