Search in sources :

Example 1 with ServiceInfo

use of org.ballerinalang.composer.server.spi.ServiceInfo in project ballerina by ballerina-lang.

the class ConfigService method getEndpoints.

private JsonObject getEndpoints() {
    JsonObject endpoints = new JsonObject();
    Set<Map.Entry<String, ServiceInfo>> entries = serviceEPMap.entrySet();
    for (Map.Entry<String, ServiceInfo> entry : entries) {
        JsonObject endpoint = new JsonObject();
        endpoint.addProperty("endpoint", getEndpoint(entry.getKey()));
        endpoints.add(entry.getKey(), endpoint);
    }
    return endpoints;
}
Also used : ServiceInfo(org.ballerinalang.composer.server.spi.ServiceInfo) JsonObject(com.google.gson.JsonObject) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with ServiceInfo

use of org.ballerinalang.composer.server.spi.ServiceInfo in project ballerina by ballerina-lang.

the class ConfigService method getEndpoint.

private String getEndpoint(String endpointName) {
    if (!serviceEPMap.containsKey(endpointName)) {
        return null;
    }
    ServiceInfo serviceInfo = serviceEPMap.get(endpointName);
    String protocol = serviceInfo.getType() == ServiceType.HTTP ? "http" : "ws";
    return protocol + "://" + serverConfig.getHost() + ":" + serverConfig.getPort() + ServerConstants.CONTEXT_ROOT + "/" + serviceInfo.getPath();
}
Also used : ServiceInfo(org.ballerinalang.composer.server.spi.ServiceInfo)

Aggregations

ServiceInfo (org.ballerinalang.composer.server.spi.ServiceInfo)2 JsonObject (com.google.gson.JsonObject)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1