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


Java SocketBinding.getPort方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:25,代码来源:CamelUndertowHostService.java

示例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());
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:10,代码来源:SwitchYardInjectorService.java

示例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;
    }
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:15,代码来源:CamelUndertowHostService.java


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