Search in sources :

Example 1 with BallerinaHTTPConnectorListener

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);
}
Also used : ServerConnector(org.wso2.transport.http.netty.contract.ServerConnector) WebSocketServerConnectorListener(org.ballerinalang.net.http.WebSocketServerConnectorListener) HttpConnectorPortBindingListener(org.ballerinalang.net.http.HttpConnectorPortBindingListener) ServerConnectorFuture(org.wso2.transport.http.netty.contract.ServerConnectorFuture) BallerinaHTTPConnectorListener(org.ballerinalang.net.http.BallerinaHTTPConnectorListener) BallerinaException(org.ballerinalang.util.exceptions.BallerinaException)

Aggregations

BallerinaHTTPConnectorListener (org.ballerinalang.net.http.BallerinaHTTPConnectorListener)1 HttpConnectorPortBindingListener (org.ballerinalang.net.http.HttpConnectorPortBindingListener)1 WebSocketServerConnectorListener (org.ballerinalang.net.http.WebSocketServerConnectorListener)1 BallerinaException (org.ballerinalang.util.exceptions.BallerinaException)1 ServerConnector (org.wso2.transport.http.netty.contract.ServerConnector)1 ServerConnectorFuture (org.wso2.transport.http.netty.contract.ServerConnectorFuture)1