use of org.ballerinalang.net.http.BallerinaHTTPConnectorListener in project ballerina by ballerina-lang.
the class Register method startServerConnector.
private void startServerConnector(Struct serviceEndpoint, HTTPServicesRegistry httpServicesRegistry, WebSocketServicesRegistry webSocketServicesRegistry) {
ServerConnector serverConnector = getServerConnector(serviceEndpoint);
ServerConnectorFuture serverConnectorFuture = serverConnector.start();
HashSet<FilterHolder> filterHolder = getFilters(serviceEndpoint);
serverConnectorFuture.setHttpConnectorListener(new BallerinaHTTPConnectorListener(httpServicesRegistry, filterHolder));
serverConnectorFuture.setWSConnectorListener(new WebSocketServerConnectorListener(webSocketServicesRegistry));
serverConnectorFuture.setPortBindingEventListener(new HttpConnectorPortBindingListener());
try {
serverConnectorFuture.sync();
} catch (Throwable ex) {
throw new BallerinaException("failed to start server connector '" + serverConnector.getConnectorID() + "': " + ex.getMessage(), ex);
}
serviceEndpoint.addNativeData(HttpConstants.CONNECTOR_STARTED, true);
}
Aggregations