org.mortbay.jetty.Server.getConnectors()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.mortbay.jetty.Server.getConnectors()方法的一些代码示例,展示了Server.getConnectors()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getConnectors()方法的具体详情如下:
包路径:org.mortbay.jetty.Server
类名称:Server
方法名:getConnectors

Server.getConnectors介绍

暂无

代码示例

代码示例来源:origin: azkaban/azkaban

public JmxJettyServer(final Server server) {
 this.server = server;
 this.connector = server.getConnectors()[0];
}

代码示例来源: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: azkaban/azkaban

private void setStatsOnConnectors(final Server server) {
 final boolean isStatsOn = this.props.getBoolean("jetty.connector.stats", true);
 logger.info("Setting up connector with stats on: " + isStatsOn);
 for (final Connector connector : server.getConnectors()) {
  connector.setStatsOn(isStatsOn);
 }
}

代码示例来源:origin: Netflix/eureka

public void start() throws Exception {
  server.start();
  port = server.getConnectors()[0].getLocalPort();
}

代码示例来源:origin: voldemort/voldemort

@Override
public void stopInner() {
  try {
    if(httpServer != null) {
      httpServer.stop();
      for(Connector c: httpServer.getConnectors()) {
        c.close();
      }
    }
    if(context != null)
      context.destroy();
  } catch(Exception e) {
    throw new VoldemortException(e);
  }
  this.httpServer = null;
  this.context = null;
}

代码示例来源:origin: pentaho/pentaho-kettle

public String getRedirectUri() throws IOException {
 if ( this.port == -1 ) {
  this.port = getUnusedPort();
 }
 this.server = new Server( this.port );
 Connector[] arr$ = this.server.getConnectors();
 int len$ = arr$.length;
 for ( int i$ = 0; i$ < len$; ++i$ ) {
  Connector c = arr$[i$];
  c.setHost( this.host );
 }
 this.server.addHandler( new CustomLocalServerReceiver.CallbackHandler() );
 try {
  this.server.start();
 } catch ( Exception var5 ) {
  Throwables.propagateIfPossible( var5 );
  throw new IOException( var5 );
 }
 return "http://" + this.host + ":" + this.port + "/Callback/success.html";
}

代码示例来源:origin: tjake/Solandra

public JettySolandraRunner( String context, int port, String host)
{

 this.context = context;
 server = new Server( port );   
 server.getConnectors()[0].setHost(host);

 server.setStopAtShutdown( true );
 // Initialize the servlets
 Context root = new Context( server, context, Context.SESSIONS );
 
 // for some reason, there must be a servlet for this to get applied
 root.addServlet( Servlet404.class, "/*" );
 dispatchFilter = root.addFilter( SolandraDispatchFilter.class, "*", Handler.REQUEST );
}

代码示例来源: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: 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: 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: 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: org.apache.hama/hama-core

/**
 * Get the port that the server is on
 * 
 * @return the port
 */
public int getPort() {
 return webServer.getConnectors()[0].getLocalPort();
}

代码示例来源:origin: org.apache.tajo/tajo-core

/**
 * Get the port that the server is on
 * @return the port
 */
public int getPort() {
 return webServer.getConnectors()[0].getLocalPort();
}

代码示例来源:origin: it.unimi.di/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.dsi/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: org.apache.isis.runtimes.dflt/webserver

private String baseFor(final Server jettyServer) {
  final Connector connector = jettyServer.getConnectors()[0];
  final String scheme = "http";
  final String host = StringUtils.coalesce(connector.getHost(), "localhost");
  final int port = connector.getPort();
  final WebAppContext handler = (WebAppContext) jettyServer.getHandler();
  final String contextPath = handler.getContextPath();
  final StringBuilder buf = new StringBuilder();
  final Formatter formatter = new Formatter(buf);
  formatter.format("%s://%s:%d/%s", scheme, host, port, contextPath);
  return appendSlashIfRequired(buf).toString();
}

代码示例来源:origin: michel-kraemer/gradle-download-task

/**
 * @return the port the embedded HTTP server is listening to
 */
protected int getServerPort() {
  return server.getConnectors()[0].getLocalPort();
}

相关文章