ServerConfig serverConfig = spi.getServerConfig();
String host = serverConfig.getWebServiceHost();
int port = serverConfig.getWebServicePort();
String hostAndPort = host + (port > 0 ? ":" + port : "");
ListenerRef listenerRef = null;
try
{
String ctx = httpSpec.getWebContext();
String pattern = httpSpec.getUrlPattern();
listenerRef = new HttpListenerRef( ctx, pattern, new URI("http://"+hostAndPort+ctx+pattern) );
} catch (URISyntaxException e)
{
throw new RuntimeException("Failed to create ListenerRef", e);
}
// Pass on to the main deployer
deploy(topLevelDeployment);
// Map listenerRef for destroy phase
deploymentRegistry.put( listenerRef.getUUID(), topLevelDeployment );
return listenerRef;
}