本文整理汇总了Java中org.jboss.as.network.SocketBinding.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java SocketBinding.getPort方法的具体用法?Java SocketBinding.getPort怎么用?Java SocketBinding.getPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.network.SocketBinding
的用法示例。
在下文中一共展示了SocketBinding.getPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateEndpointPort
import org.jboss.as.network.SocketBinding; //导入方法依赖的package包/类
private void validateEndpointPort(URI httpURI) {
// Camel HTTP endpoint port defaults are 0 or -1
boolean portMatched = httpURI.getPort() == 0 || httpURI.getPort() == -1;
// If a port was specified, verify that undertow has a listener configured for it
if (!portMatched) {
for (UndertowListener listener : defaultHost.getServer().getListeners()) {
SocketBinding binding = listener.getSocketBinding();
if (binding != null) {
if (binding.getPort() == httpURI.getPort()) {
portMatched = true;
break;
}
}
}
}
if (!"localhost".equals(httpURI.getHost())) {
LOGGER.debug("Cannot bind to host other than 'localhost': {}", httpURI);
}
if (!portMatched) {
LOGGER.debug("Cannot bind to specific port: {}", httpURI);
}
}
示例2: start
import org.jboss.as.network.SocketBinding; //导入方法依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
for (String key : _socketBindings.keySet()) {
SocketBinding binding = _socketBindings.get(key).getValue();
SocketAddr addr = new SocketAddr(binding.getAddress().getHostAddress(), binding.getPort());
LOG.trace("Injecting socket binding '" + addr + "'");
_injectedValues.put(key, addr.toString());
}
}
示例3: getConnectionURL
import org.jboss.as.network.SocketBinding; //导入方法依赖的package包/类
private URL getConnectionURL() throws StartException {
SocketBinding socketBinding = injectedHttpSocketBinding.getValue();
InetAddress address = socketBinding.getNetworkInterfaceBinding().getAddress();
URL result;
try {
String hostAddress = NetworkUtils.formatPossibleIpv6Address(address.getHostAddress());
result = new URL(socketBinding.getName() + "://" + hostAddress + ":" + socketBinding.getPort());
} catch (MalformedURLException ex) {
throw new StartException(ex);
}
return result;
}