本文整理汇总了Java中com.orientechnologies.orient.server.network.OServerNetworkListener类的典型用法代码示例。如果您正苦于以下问题:Java OServerNetworkListener类的具体用法?Java OServerNetworkListener怎么用?Java OServerNetworkListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OServerNetworkListener类属于com.orientechnologies.orient.server.network包,在下文中一共展示了OServerNetworkListener类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzeServerConfig
import com.orientechnologies.orient.server.network.OServerNetworkListener; //导入依赖的package包/类
/**
* Analyze started server ports.
*
* @param server started orient server
* @return selected main http listener or null if nothing configured
*/
private OServerNetworkListener analyzeServerConfig(final OServer server) {
OServerNetworkListener httpListener = null;
for (OServerNetworkListener listener : server.getNetworkListeners()) {
final int port = listener.getInboundAddr().getPort();
final boolean secured = OrientConfigUtils.isSslEnabledOnPort(conf.getConfig(), port);
if (ONetworkProtocolHttpAbstract.class.isAssignableFrom(listener.getProtocolType())) {
serverInfo.httpPorts.put(String.valueOf(port), secured);
if (serverInfo.httpPort == null || secured) {
serverInfo.httpPort = String.valueOf(port);
serverInfo.httpSecured = secured;
httpListener = listener;
}
} else {
serverInfo.binaryPorts.put(String.valueOf(port), secured);
}
}
return httpListener;
}
示例2: startup
import com.orientechnologies.orient.server.network.OServerNetworkListener; //导入依赖的package包/类
@Override
public void startup() {
if (!enabled)
return;
Orient.instance().addDbLifecycleListener(this);
final OServerNetworkListener listener = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if (listener == null)
throw new OConfigurationException("HTTP listener not found");
listener.registerStatelessCommand(new OServerCommandESSync(this));
}
示例3: resolveOrientDBRestApiUrl
import com.orientechnologies.orient.server.network.OServerNetworkListener; //导入依赖的package包/类
/**
* Resolve OrientDB REST API URL to be used for OrientDb REST bridge
* @return OrientDB REST API URL
*/
public String resolveOrientDBRestApiUrl()
{
OrientDbWebApplication app = OrientDbWebApplication.get();
OServer server = app.getServer();
if(server!=null)
{
OServerNetworkListener http = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if(http!=null)
{
return "http://"+http.getListeningAddress(true);
}
}
return null;
}
示例4: installStudio
import com.orientechnologies.orient.server.network.OServerNetworkListener; //导入依赖的package包/类
/**
* 2 http ports could be registered. One listener will be selected as main to redirect studio.
* This will be either https or the first http listener.
*
* @param listener http listener to install studio on
* @throws Exception on installation errors
*/
private void installStudio(final OServerNetworkListener listener) throws Exception {
if (listener != null) {
final OServerCommandGetStaticContent command = (OServerCommandGetStaticContent) listener
.getCommand(OServerCommandGetStaticContent.class);
if (command != null) {
serverInfo.studioInstalled = new OrientStudioInstaller(command).install();
listener.registerStatelessCommand(new ApiRedirectCommand());
}
}
}
示例5: findListenerByPort
import com.orientechnologies.orient.server.network.OServerNetworkListener; //导入依赖的package包/类
/**
* @param network network configuration object
* @param port port to search by
* @return listener handling provided port, otherwise exception is thrown
*/
public static OServerNetworkListenerConfiguration findListenerByPort(
final OServerNetworkConfiguration network, final int port) {
return network.listeners.stream()
.filter(l -> {
for (int rPort : OServerNetworkListener.getPorts(l.portRange)) {
if (rPort == port) {
return true;
}
}
return false;
}).collect(onlyElement());
}