本文整理了Java中org.mortbay.jetty.Connector.getLocalPort()
方法的一些代码示例,展示了Connector.getLocalPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connector.getLocalPort()
方法的具体详情如下:
包路径:org.mortbay.jetty.Connector
类名称:Connector
方法名:getLocalPort
暂无
代码示例来源:origin: tjake/Solandra
/**
* Returns the Local Port of the first Connector found for the jetty Server.
* @exception RuntimeException if there is no Connector
*/
public int getLocalPort() {
Connector[] conns = server.getConnectors();
if (0 == conns.length) {
throw new RuntimeException("Jetty Server has no Connectors");
}
return conns[0].getLocalPort();
}
代码示例来源:origin: Netflix/eureka
public void start() throws Exception {
server.start();
port = server.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: Netflix/eureka
public void start() throws Exception {
server = new Server(port);
server.setHandler(new AppsResourceHandler());
server.start();
port = server.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: testcontainers/testcontainers-java
@Before
public void setupLocalServer() throws Exception {
// Set up a local Jetty HTTP server
Server server = new Server();
server.addConnector(new SocketConnector());
ResourceHandler resourceHandler = new ResourceHandler();
resourceHandler.setResourceBase("src/test/resources/server");
server.addHandler(resourceHandler);
server.start();
// The server will have a random port assigned, so capture that
localPort = server.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: mapsforge/mapsforge
protected final int getPort() {
return this.server.getConnectors()[0].getLocalPort();
}
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-server
/**
* Returns the Local Port of the first Connector found for the jetty Server.
* @exception RuntimeException if there is no Connector
*/
public int getLocalPort() {
Connector[] conns = server.getConnectors();
if (0 == conns.length) {
throw new RuntimeException("Jetty Server has no Connectors");
}
return conns[0].getLocalPort();
}
代码示例来源:origin: io.hops/hadoop-common
/**
* Get the port that the server is on
* @return the port
*/
@Deprecated
public int getPort() {
return webServer.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Get the port that the server is on
* @return the port
*/
@Deprecated
public int getPort() {
return webServer.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: com.facebook.hadoop/hadoop-core
/**
* Get the port that the server is on
* @return the port
*/
public int getPort() {
return webServer.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: io.fabric8/fabric-hadoop
/**
* Get the port that the server is on
* @return the port
*/
public int getPort() {
return webServer.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: io.hops/hadoop-common
/**
* Get the port that the server is on
* @return the port
*/
@Deprecated
public int getPort() {
return webServer.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: apache/hama
/**
* Get the port that the server is on
*
* @return the port
*/
public int getPort() {
return webServer.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
/**
* Get the port that the server is on
* @return the port
*/
@Deprecated
public int getPort() {
return webServer.getConnectors()[0].getLocalPort();
}
代码示例来源:origin: io.hops/hadoop-common
/**
* Get the port that corresponds to a particular connector. In the case of
* HDFS, the second connector corresponds to the HTTPS connector.
*
* @return the corresponding port for the connector, or -1 if there's no such
* connector.
*/
public int getConnectorPort(int index) {
Preconditions.checkArgument(index >= 0);
return index < webServer.getConnectors().length ?
webServer.getConnectors()[index].getLocalPort() : -1;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Return the bind address of the listener.
* @return InetSocketAddress of the listener
*/
public InetSocketAddress getListenerAddress() {
int port = listener.getLocalPort();
if (port == -1) { // not bound, return requested port
port = listener.getPort();
}
return new InetSocketAddress(listener.getHost(), port);
}
代码示例来源:origin: it.unimi.dsi/mg4j-big
/** Returns the port assigned to the server.
*
* @return the port assigned to the server.
*/
public static int getPort() {
if ( port == 0 ) {
if ( ! SERVER.isStarted() ) throw new IllegalStateException( "The server is not started yet" );
port = SERVER.getConnectors()[ 0 ].getLocalPort();
}
return port;
}
代码示例来源:origin: it.unimi.di/mg4j
/** Returns the port assigned to the server.
*
* @return the port assigned to the server.
*/
public static int getPort() {
if ( port == 0 ) {
if ( ! SERVER.isStarted() ) throw new IllegalStateException( "The server is not started yet" );
port = SERVER.getConnectors()[ 0 ].getLocalPort();
}
return port;
}
代码示例来源:origin: io.hops/hadoop-common
/**
* Return the host and port of the HttpServer, if live
* @return the classname and any HTTP URL
*/
@Override
public String toString() {
return listener != null ?
("HttpServer at http://" + listener.getHost() + ":" + listener.getLocalPort() + "/"
+ (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE))
: "Inactive HttpServer";
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Return the host and port of the HttpServer, if live
* @return the classname and any HTTP URL
*/
@Override
public String toString() {
return listener != null ?
("HttpServer at http://" + listener.getHost() + ":" + listener.getLocalPort() + "/"
+ (isAlive() ? STATE_DESCRIPTION_ALIVE : STATE_DESCRIPTION_NOT_LIVE))
: "Inactive HttpServer";
}
代码示例来源:origin: michel-kraemer/gradle-download-task
/**
* @return the port the embedded HTTP server is listening to
*/
protected int getServerPort() {
return server.getConnectors()[0].getLocalPort();
}
内容来源于网络,如有侵权,请联系作者删除!