if (ports.contains(port)) {
throw new ConfigurationException("A service for port '" + port + "' has already been configured.");
}
ports.add(port);
EsperHttpServiceBase httpService;
if (entry.getValue().isNio()) {
try {
Class.forName("org.apache.http.nio.NHttpServiceHandler");
} catch (ClassNotFoundException e) {
throw new ConfigurationException("NIO Handler not found in classpath, please ensure httpcore-nio exists in classpath.");
}
httpService = new EsperHttpServiceNIO(entry.getKey(), entry.getValue());
}
else {
httpService = new EsperHttpServiceClassic(entry.getKey(), entry.getValue());
}
services.put(entry.getKey(), httpService);
}
// Add handlers (input adapter)
for (GetHandler handler : config.getGetHandlers()) {
if (!services.containsKey(handler.getService())) {
throw new ConfigurationException("A service by name '" + handler.getService() + "' has not been configured.");
}
EsperHttpServiceBase httpService = services.get(handler.getService());
httpService.add(handler);
}
// Start services
for (EsperHttpServiceBase service : services.values()) {
try {