Search in sources :

Example 1 with TransportsConfiguration

use of org.wso2.transport.http.netty.config.TransportsConfiguration in project carbon-apimgt by wso2.

the class RestApiUtil method getHost.

public static String getHost(String protocol) {
    TransportsConfiguration transportsConfiguration = YAMLTransportConfigurationBuilder.build();
    Set<ListenerConfiguration> listenerConfigurationSet = transportsConfiguration.getListenerConfigurations();
    String host = apimConfigurations.getHostname();
    if (!apimConfigurations.isReverseProxyEnabled()) {
        if (HTTP.equals(protocol)) {
            for (ListenerConfiguration listenerConfiguration : listenerConfigurationSet) {
                if (HTTP.equals(listenerConfiguration.getScheme())) {
                    host = host.concat(":").concat(String.valueOf(listenerConfiguration.getPort()));
                    break;
                }
            }
        } else {
            for (ListenerConfiguration listenerConfiguration : listenerConfigurationSet) {
                if (HTTPS.equals(listenerConfiguration.getScheme())) {
                    host = host.concat(":").concat(String.valueOf(listenerConfiguration.getPort()));
                }
            }
        }
    }
    return host;
}
Also used : ListenerConfiguration(org.wso2.transport.http.netty.config.ListenerConfiguration) TransportsConfiguration(org.wso2.transport.http.netty.config.TransportsConfiguration)

Aggregations

ListenerConfiguration (org.wso2.transport.http.netty.config.ListenerConfiguration)1 TransportsConfiguration (org.wso2.transport.http.netty.config.TransportsConfiguration)1