当前位置: 首页>>代码示例>>Java>>正文


Java NetworkUtils.getMgtHostName方法代码示例

本文整理汇总了Java中org.wso2.carbon.utils.NetworkUtils.getMgtHostName方法的典型用法代码示例。如果您正苦于以下问题:Java NetworkUtils.getMgtHostName方法的具体用法?Java NetworkUtils.getMgtHostName怎么用?Java NetworkUtils.getMgtHostName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.utils.NetworkUtils的用法示例。


在下文中一共展示了NetworkUtils.getMgtHostName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getServerBaseHttpsUrl

import org.wso2.carbon.utils.NetworkUtils; //导入方法依赖的package包/类
public static String getServerBaseHttpsUrl() {
    String hostName = "localhost";
    try {
        hostName = NetworkUtils.getMgtHostName();
    } catch (Exception ignored) {
    }
    String mgtConsoleTransport = CarbonUtils.getManagementTransport();
    ConfigurationContextService configContextService =
            DeviceManagementDataHolder.getInstance().getConfigurationContextService();
    int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport);
    int httpsProxyPort =
            CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(),
                    mgtConsoleTransport);
    if (httpsProxyPort > 0) {
        port = httpsProxyPort;
    }
    return "https://" + hostName + ":" + port;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:19,代码来源:DeviceManagerUtil.java

示例2: getServerBaseHttpUrl

import org.wso2.carbon.utils.NetworkUtils; //导入方法依赖的package包/类
public static String getServerBaseHttpUrl() {
    String hostName = "localhost";
    try {
        hostName = NetworkUtils.getMgtHostName();
    } catch (Exception ignored) {
    }
    ConfigurationContextService configContextService =
            DeviceManagementDataHolder.getInstance().getConfigurationContextService();
    int port = CarbonUtils.getTransportPort(configContextService, "http");
    int httpProxyPort =
            CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(),
                    "http");
    if (httpProxyPort > 0) {
        port = httpProxyPort;
    }
    return "http://" + hostName + ":" + port;
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceManagerUtil.java

示例3: getServerUrl

import org.wso2.carbon.utils.NetworkUtils; //导入方法依赖的package包/类
private String getServerUrl() {
    // Hostname
    String hostName = "localhost";
    try {
        hostName = NetworkUtils.getMgtHostName();
    } catch (Exception ignored) {
    }
    // HTTPS port
    String mgtConsoleTransport = CarbonUtils.getManagementTransport();
    ConfigurationContextService configContextService =
            UrlPrinterDataHolder.getInstance().getConfigurationContextService();
    int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport);
    int httpsProxyPort =
            CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), mgtConsoleTransport);
    if (httpsProxyPort > 0) {
        port = httpsProxyPort;
    }
    return "https://" + hostName + ":" + port + "/devicemgt";
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:20,代码来源:URLPrinterStartupHandler.java

示例4: setBasePath

import org.wso2.carbon.utils.NetworkUtils; //导入方法依赖的package包/类
public void setBasePath(String basePath)
{
    // Hostname
    String hostName = "localhost";
    try {
        hostName = NetworkUtils.getMgtHostName();
    } catch (Exception ignored) {
    }

    super.setBasePath("https://" +
                      hostName + ":" + System.getProperty("mgt.transport.https.port") +
                      "/resource/1.0.0");
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:14,代码来源:SwaggerJaxrsConfig.java

示例5: getAdminConsoleURL

import org.wso2.carbon.utils.NetworkUtils; //导入方法依赖的package包/类
/**
 * Returns url to admin console.
 *
 * @param context Webapp context root of the Carbon webapp
 * @return The URL of the Admin Console
 */
public static String getAdminConsoleURL(String context) {
    // Hostname
    String hostName = "localhost";
    try {
        hostName = NetworkUtils.getMgtHostName();
    } catch (Exception ignored) {
    }

    // HTTPS port
    String mgtConsoleTransport = CarbonUtils.getManagementTransport();
    ConfigurationContextService configContextService = CarbonUIServiceComponent
        .getConfigurationContextService();
    int httpsPort = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport);
    int httpsProxyPort =
        CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(),
                                          mgtConsoleTransport);
    // Context
    if ("/".equals(context)) {
        context = "";
    }

    String proxyContextPath = CarbonUIUtil.getProxyContextPath(false);

    String adminConsoleURL =  "https://" + hostName + ":" + (httpsProxyPort != -1 ? httpsProxyPort : httpsPort) +
            proxyContextPath + context + "/carbon/";

    if(log.isDebugEnabled()){
        log.debug("Generated admin console URL: " + adminConsoleURL);
    }

    return adminConsoleURL;
}
 
开发者ID:apache,项目名称:stratos,代码行数:39,代码来源:CarbonUIUtil.java

示例6: setBasePath

import org.wso2.carbon.utils.NetworkUtils; //导入方法依赖的package包/类
public void setBasePath(String basePath)
{
    // Hostname
    String hostName = "localhost";
    try {
        hostName = NetworkUtils.getMgtHostName();
    } catch (Exception ignored) {
    }

    super.setBasePath("https://" +
            hostName + ":" + System.getProperty("mgt.transport.https.port") + "/governance");
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:13,代码来源:SwaggerJaxrsConfig.java


注:本文中的org.wso2.carbon.utils.NetworkUtils.getMgtHostName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。