assert generator!=null;
// Resolve the endpoint address
if(! (transportSpec instanceof HttpSpec))
throw new IllegalArgumentException("Unknown TransportSpec " + transportSpec);
HttpSpec httpSpec = (HttpSpec)transportSpec;
// Create JBossWebMetaData and attach it to the DeploymentUnit
Deployment topLevelDeployment = endpoint.getService().getDeployment();
// TODO: Somehow the ServletClass and InitParameter need to go from TransportSpec into generator
topLevelDeployment.setProperty(HttpSpec.PROPERTY_WEBAPP_SERVLET_CLASS, httpSpec.getServletClass());
topLevelDeployment.setProperty(HttpSpec.PROPERTY_WEBAPP_CONTEXT_PARAMETERS, httpSpec.getContextParameter());
JBossWebMetaData jbwMetaData = generator.create(topLevelDeployment);
deploymentFactory.create(topLevelDeployment, jbwMetaData);
SPIProvider provider = SPIProviderResolver.getInstance().getProvider();
ServerConfigFactory spi = provider.getSPI(ServerConfigFactory.class);
ServerConfig serverConfig = spi.getServerConfig();
String host = serverConfig.getWebServiceHost();
int port = serverConfig.getWebServicePort();
String hostAndPort = host + (port > 0 ? ":" + port : "");
try
{
String ctx = httpSpec.getWebContext();
String pattern = httpSpec.getUrlPattern();
ListenerRef ref = new HttpListenerRef(
ctx, pattern,
new URI("http://"+hostAndPort+ctx+pattern)
);