Java 类org.eclipse.jetty.server.AbstractNetworkConnector 实例源码
项目:karamel
文件:KaramelServiceApplication.java
public int getPort(Environment environment) {
int defaultPort = 9090;
MutableServletContextHandler h = environment.getApplicationContext();
if (h == null) {
return defaultPort;
}
Server s = h.getServer();
if (s == null) {
return defaultPort;
}
Connector[] c = s.getConnectors();
if (c != null && c.length > 0) {
AbstractNetworkConnector anc = (AbstractNetworkConnector) c[0];
if (anc != null) {
return anc.getLocalPort();
}
}
return defaultPort;
}
项目:ignite
文件:GridJettyRestProtocol.java
/**
* Checks {@link org.apache.ignite.IgniteSystemProperties#IGNITE_JETTY_PORT} system property
* and overrides default connector port if it present.
* Then initializes {@code port} with the found value.
*
* @param con Jetty connector.
*/
private void override(AbstractNetworkConnector con) {
String host = System.getProperty(IGNITE_JETTY_HOST);
if (!F.isEmpty(host))
con.setHost(host);
int currPort = con.getPort();
Integer overridePort = Integer.getInteger(IGNITE_JETTY_PORT);
if (overridePort != null && overridePort != 0)
currPort = overridePort;
con.setPort(currPort);
port = currPort;
}
项目:Wiab.pro
文件:ServerRpcProvider.java
/**
* Returns the socket the WebSocket server is listening on.
*/
public SocketAddress getWebSocketAddress() {
if (httpServer == null) {
return null;
} else {
AbstractNetworkConnector c = (AbstractNetworkConnector)httpServer.getConnectors()[0];
return new InetSocketAddress(c.getHost(), c.getLocalPort());
}
}
项目:indoqa-boot
文件:JettyPortReader.java
protected static int getPortFromJetty(Service sparkService) {
Service inspectedService = sparkService;
try {
if (inspectedService == null) {
inspectedService = getSparkService();
}
EmbeddedJettyServer embeddedJettyServer = getEmbeddedJettyServer(inspectedService);
AbstractNetworkConnector connector = getConnector(embeddedJettyServer);
return connector.getPort();
} catch (Exception e) {
LOGGER.error("Error while reading Jetty server port.", e);
}
return 0;
}
项目:indoqa-boot
文件:JettyPortReader.java
private static AbstractNetworkConnector getConnector(EmbeddedJettyServer embeddedJettyServer)
throws NoSuchFieldException, IllegalAccessException {
Field serverField = embeddedJettyServer.getClass().getDeclaredField("server");
serverField.setAccessible(true);
Server server = (Server) serverField.get(embeddedJettyServer);
return (AbstractNetworkConnector) server.getConnectors()[0];
}
项目:ignite
文件:GridJettyRestProtocol.java
/**
* Checks that the only connector configured for the current jetty instance
* and returns it.
*
* @return Connector instance.
* @throws IgniteCheckedException If no or more than one connectors found.
*/
private AbstractNetworkConnector getJettyConnector() throws IgniteCheckedException {
if (httpSrv.getConnectors().length == 1) {
Connector connector = httpSrv.getConnectors()[0];
if (!(connector instanceof AbstractNetworkConnector))
throw new IgniteCheckedException("Error in jetty configuration. Jetty connector should extend " +
"AbstractNetworkConnector class." );
return (AbstractNetworkConnector)connector;
}
else
throw new IgniteCheckedException("Error in jetty configuration [connectorsFound=" +
httpSrv.getConnectors().length + "connectorsExpected=1]");
}
项目:EvoMaster
文件:SutController.java
/**
* @return the actual port in use (eg, if it was an ephemeral 0)
*/
public final int getControllerServerPort() {
return ((AbstractNetworkConnector) controllerServer.getConnectors()[0]).getLocalPort();
}
项目:EvoMaster
文件:SimpleFormApplication.java
public int getJettyPort() {
return ((AbstractNetworkConnector) jettyServer.getConnectors()[0]).getLocalPort();
}
项目:EvoMaster
文件:PIApplication.java
public int getJettyPort(){
return ((AbstractNetworkConnector)jettyServer.getConnectors()[0]).getLocalPort();
}
项目:Ultrastructure
文件:PhantasmBundle.java
public int getPort() {
return ((AbstractNetworkConnector) environment.getApplicationContext()
.getServer()
.getConnectors()[0]).getLocalPort();
}