本文整理匯總了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());
}