use of org.jboss.metadata.web.jboss.JBossWebMetaData in project wildfly by wildfly.
the class AbstractDeploymentModelBuilder method propagateAttachments.
private void propagateAttachments(final DeploymentUnit unit, final ArchiveDeployment dep) {
dep.addAttachment(DeploymentUnit.class, unit);
unit.putAttachment(DEPLOYMENT_KEY, dep);
final JBossWebMetaData webMD = getJBossWebMetaData(unit);
dep.addAttachment(JBossWebMetaData.class, webMD);
final WebservicesMetaData webservicesMD = getOptionalAttachment(unit, WEBSERVICES_METADATA_KEY);
dep.addAttachment(WebservicesMetaData.class, webservicesMD);
JBossWebservicesMetaData jbossWebservicesMD = getOptionalAttachment(unit, JBOSS_WEBSERVICES_METADATA_KEY);
if (unit.getParent() != null) {
jbossWebservicesMD = JBossWebservicesMetaData.merge(getOptionalAttachment(unit.getParent(), JBOSS_WEBSERVICES_METADATA_KEY), jbossWebservicesMD);
}
dep.addAttachment(JBossWebservicesMetaData.class, jbossWebservicesMD);
final JAXWSDeployment jaxwsDeployment = getOptionalAttachment(unit, JAXWS_ENDPOINTS_KEY);
dep.addAttachment(JAXWSDeployment.class, jaxwsDeployment);
final EjbJarMetaData ejbJarMD = getOptionalAttachment(unit, EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
dep.addAttachment(EjbJarMetaData.class, ejbJarMD);
final RejectionRule rr = getOptionalAttachment(unit, REJECTION_RULE_KEY);
if (rr != null) {
dep.addAttachment(RejectionRule.class, rr);
}
}
use of org.jboss.metadata.web.jboss.JBossWebMetaData in project wildfly by wildfly.
the class EndpointService method getDeploymentSecurityDomainName.
private static String getDeploymentSecurityDomainName(final Endpoint ep) {
JBossWebMetaData metadata = ep.getService().getDeployment().getAttachment(JBossWebMetaData.class);
String metaDataSecurityDomain = metadata != null ? metadata.getSecurityDomain() : null;
return metaDataSecurityDomain == null ? SecurityConstants.DEFAULT_APPLICATION_POLICY : SecurityUtil.unprefixSecurityDomain(metaDataSecurityDomain.trim());
}
use of org.jboss.metadata.web.jboss.JBossWebMetaData in project wildfly by wildfly.
the class MetaDataBuilderJAXWS_EJB method buildEnterpriseBeansMetaData.
@Override
protected void buildEnterpriseBeansMetaData(final Deployment dep, final EJBArchiveMetaData.Builder ejbArchiveMDBuilder) {
if (!WSHelper.isJaxwsJseDeployment(dep)) {
// [AS7-1605] support
final JBossWebMetaData jbossWebMD = WSHelper.getOptionalAttachment(dep, JBossWebMetaData.class);
final String contextRoot = getContextRoot(dep, jbossWebMD);
if (contextRoot != null) {
final JSEArchiveMetaData.Builder jseArchiveMDBuilder = new JSEArchiveMetaData.Builder();
jseArchiveMDBuilder.setContextRoot(contextRoot);
dep.addAttachment(JSEArchiveMetaData.class, jseArchiveMDBuilder.build());
}
}
final JAXWSDeployment jaxwsDeployment = WSHelper.getRequiredAttachment(dep, JAXWSDeployment.class);
final List<EJBMetaData> wsEjbsMD = new LinkedList<EJBMetaData>();
final JBossWebservicesMetaData jbossWebservicesMD = WSHelper.getOptionalAttachment(dep, JBossWebservicesMetaData.class);
for (final EJBEndpoint jbossEjbMD : jaxwsDeployment.getEjbEndpoints()) {
buildEnterpriseBeanMetaData(wsEjbsMD, jbossEjbMD, jbossWebservicesMD);
}
ejbArchiveMDBuilder.setEnterpriseBeans(wsEjbsMD);
}
use of org.jboss.metadata.web.jboss.JBossWebMetaData in project wildfly by wildfly.
the class EndpointPublisherImpl method startWebApp.
private static WebDeploymentController startWebApp(WebHost host, DeploymentUnit unit) throws Exception {
WebDeploymentBuilder deployment = new WebDeploymentBuilder();
WebDeploymentController handle;
try {
JBossWebMetaData jbwebMD = unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY);
deployment.setContextRoot(jbwebMD.getContextRoot());
ServerConfigService config = (ServerConfigService) unit.getServiceRegistry().getService(WSServices.CONFIG_SERVICE).getService();
File docBase = new File(config.getValue().getServerTempDir(), jbwebMD.getContextRoot());
if (!docBase.exists()) {
docBase.mkdirs();
}
deployment.setDocumentRoot(docBase);
deployment.setClassLoader(unit.getAttachment(WSAttachmentKeys.CLASSLOADER_KEY));
deployment.addAllowedRequestPredicate(new AllowWSRequestPredicate());
addServlets(jbwebMD, deployment);
handle = host.addWebDeployment(deployment);
handle.create();
} catch (Exception e) {
throw WSLogger.ROOT_LOGGER.createContextPhaseFailed(e);
}
try {
handle.start();
} catch (Exception e) {
throw WSLogger.ROOT_LOGGER.startContextPhaseFailed(e);
}
return handle;
}
use of org.jboss.metadata.web.jboss.JBossWebMetaData in project wildfly by wildfly.
the class ASHelper method getJBossWebMetaData.
/**
* Gets the JBossWebMetaData from the WarMetaData attached to the provided deployment unit, if any.
*
* @param unit
* @return the JBossWebMetaData or null if either that or the parent WarMetaData are not found.
*/
public static JBossWebMetaData getJBossWebMetaData(final DeploymentUnit unit) {
final WarMetaData warMetaData = getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
JBossWebMetaData result = null;
if (warMetaData != null) {
result = warMetaData.getMergedJBossWebMetaData();
if (result == null) {
result = warMetaData.getJBossWebMetaData();
}
} else {
result = getOptionalAttachment(unit, WSAttachmentKeys.JBOSSWEB_METADATA_KEY);
}
return result;
}
Aggregations