/** Publishes the endpoints declared to the provided WSEndpointDeploymentUnit */ public List<Endpoint> publish(ServiceTarget target, WSEndpointDeploymentUnit unit) throws Exception { List<DeploymentAspect> aspects = DeploymentAspectsProvider.getSortedDeploymentAspects(); ClassLoader origClassLoader = SecurityActions.getContextClassLoader(); Deployment dep = null; try { SecurityActions.setContextClassLoader( ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader()); WSDeploymentBuilder.getInstance().build(unit); dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY); dep.addAttachment(ServiceTarget.class, target); DeploymentAspectManager dam = new DeploymentAspectManagerImpl(); dam.setDeploymentAspects(aspects); dam.deploy(dep); } finally { if (dep != null) { dep.removeAttachment(ServiceTarget.class); } SecurityActions.setContextClassLoader(origClassLoader); } Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY); deployment.addAttachment( StandardContext.class, startWebApp(host, unit)); // TODO simplify and use findChild later in destroy()/stopWebApp() return deployment.getService().getEndpoints(); }