Java Code Examples for com.alibaba.dubbo.common.utils.NetUtils#getHostName()

The following examples show how to use com.alibaba.dubbo.common.utils.NetUtils#getHostName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Tool.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public static String getHostName(String address) {
    if (address != null && address.length() > 0) {
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + "/";
        }
    }
    return "";
}
 
Example 2
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static String getHostName(String address) {
    if (address != null && address.length() > 0) {
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + "/";
        }
    }
    return "";
}
 
Example 3
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static String getHostAddress(String address) {
    if (address != null && address.length() > 0) {
        int i = address.indexOf(':');
        String port = address.substring(i+1);
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + ":" + port;
        }
    }
    return "";
}
 
Example 4
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static String getHostName(String address) {
    if (address != null && address.length() > 0) {
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + "/";
        }
    }
    return "";
}
 
Example 5
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static String getHostAddress(String address) {
    if (address != null && address.length() > 0) {
        int i = address.indexOf(':');
        String port = address.substring(i+1);
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + ":" + port;
        }
    }
    return "";
}
 
Example 6
Source File: Tool.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public static String getHostName(String address) {
    if (address != null && address.length() > 0) {
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + "/";
        }
    }
    return "";
}
 
Example 7
Source File: Tool.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public static String getHostAddress(String address) {
    if (address != null && address.length() > 0) {
        int i = address.indexOf(':');
        String port = address.substring(i+1);
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + ":" + port;
        }
    }
    return "";
}
 
Example 8
Source File: Tool.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public static String getHostAddress(String address) {
    if (address != null && address.length() > 0) {
        int i = address.indexOf(':');
        String port = address.substring(i+1);
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + ":" + port;
        }
    }
    return "";
}
 
Example 9
Source File: ServersController.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/clients", method = RequestMethod.GET)
public String clients(@RequestParam int port, Model model) {
	Collection<ExchangeServer> servers = DubboProtocol.getDubboProtocol().getServers();

	ExchangeServer server = null;
	String serverAddress = "";
	if (servers != null && servers.size() > 0) {
		for (ExchangeServer s : servers) {
			int sp = s.getUrl().getPort();
			if (port == 0 && server == null || port == sp) {
				server = s;
				serverAddress = NetUtils.getHostName(s.getUrl().getAddress()) + "/" + s.getUrl().getAddress();
			}
		}
	}

	List<String> rows = new ArrayList<String>();

	if (server != null) {
		Collection<ExchangeChannel> channels = server.getExchangeChannels();
		for (ExchangeChannel c : channels) {
			String address = NetUtils.toAddressString(c.getRemoteAddress());
			rows.add(NetUtils.getHostName(address) + "/" + address);
		}
	}

	model.addAttribute("port", port);
	model.addAttribute("server", serverAddress);
	model.addAttribute("rows", rows);
	return "server/clients";
}
 
Example 10
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static String getHostName(String address) {
    if (address != null && address.length() > 0) {
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + "/";
        }
    }
    return "";
}
 
Example 11
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static String getHostAddress(String address) {
    if (address != null && address.length() > 0) {
        int i = address.indexOf(':');
        String port = address.substring(i+1);
        String hostname = NetUtils.getHostName(address);
        if (! address.equals(hostname)) {
            return hostname + ":" + port;
        }
    }
    return "";
}
 
Example 12
Source File: Tool.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
public static String getHostName(String address) {
    if (address != null && address.length() > 0) {
        String hostname = NetUtils.getHostName(address);
        if (!address.equals(hostname)) {
            return hostname + "/";
        }
    }
    return "";
}
 
Example 13
Source File: Tool.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
public static String getHostAddress(String address) {
    if (address != null && address.length() > 0) {
        int i = address.indexOf(':');
        String port = address.substring(i + 1);
        String hostname = NetUtils.getHostName(address);
        if (!address.equals(hostname)) {
            return hostname + ":" + port;
        }
    }
    return "";
}
 
Example 14
Source File: Tool.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public static String getHostName(String address) {
    return NetUtils.getHostName(address);
}
 
Example 15
Source File: Tool.java    From open-capacity-platform with Apache License 2.0 4 votes vote down vote up
public static String getHostName(String address) {
    return NetUtils.getHostName(address);
}
 
Example 16
Source File: Tool.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public static String getHostName(String address) {
    return NetUtils.getHostName(address);
}
 
Example 17
Source File: Tool.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static String getHostName(String address) {
    return NetUtils.getHostName(address);
}
 
Example 18
Source File: Tool.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static String getHostName(String address) {
    return NetUtils.getHostName(address);
}
 
Example 19
Source File: Tool.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public static String getHostName(String address) {
    return NetUtils.getHostName(address);
}