use of org.jboss.as.webservices.service.ServerConfigService 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;
}
Aggregations