本文整理汇总了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;
}
示例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;
}
示例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";
}
示例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");
}
示例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;
}
示例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");
}