当前位置: 首页>>代码示例>>Java>>正文


Java SocketConnector.setHost方法代码示例

本文整理汇总了Java中org.mortbay.jetty.bio.SocketConnector.setHost方法的典型用法代码示例。如果您正苦于以下问题:Java SocketConnector.setHost方法的具体用法?Java SocketConnector.setHost怎么用?Java SocketConnector.setHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mortbay.jetty.bio.SocketConnector的用法示例。


在下文中一共展示了SocketConnector.setHost方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startServer

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
/**
 * Starts the Jetty server at a specified port.
 *
 * Will try up to 10 ports to find an available port to use.
 *
 * @param portno
 *          Port number.
 * @throws Exception
 *           When an error occurs.
 */
private void startServer(int portno) throws Exception {
  SocketConnector listener = new SocketConnector();
  listener.setHost("127.0.0.1");
  server.addConnector(listener);
  for (int p = portno; p < portno + 10; p++) {
    port = portno;
    listener.setPort(port);
    try {
      server.start();
      break;
    } catch (Exception e) {
      if (p == portno + 9) {
        throw e;
      }
    }
  }
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:28,代码来源:TestProtocolHttpClient.java

示例2: getServer

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
/**
 * Creates a new JettyServer with one static root context
 * 
 * @param port
 *          port to listen to
 * @param staticContent
 *          folder where static content lives
 * @throws UnknownHostException
 */
public static Server getServer(int port, String staticContent)
    throws UnknownHostException {
  Server webServer = new org.mortbay.jetty.Server();
  SocketConnector listener = new SocketConnector();
  listener.setPort(port);
  listener.setHost("127.0.0.1");
  webServer.addConnector(listener);
  ContextHandler staticContext = new ContextHandler();
  staticContext.setContextPath("/");
  staticContext.setResourceBase(staticContent);
  staticContext.addHandler(new ResourceHandler());
  webServer.addHandler(staticContext);
  return webServer;
}
 
开发者ID:jorcox,项目名称:GeoCrawler,代码行数:24,代码来源:CrawlDBTestUtil.java

示例3: startServer

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
/**
 * Starts the Jetty server at a specified port.
 *
 * @param  portno     Port number.
 * @throws Exception  When an error occurs.
 */
private void startServer(int portno) throws Exception {
  port = portno;
  SocketConnector listener = new SocketConnector();
  listener.setHost("127.0.0.1");
  listener.setPort(port);
  server.addConnector(listener);
  server.start();
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:15,代码来源:TestProtocolHttpClient.java

示例4: getServer

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
/**
 * Creates a new JettyServer with one static root context
 * 
 * @param port port to listen to
 * @param staticContent folder where static content lives
 * @throws UnknownHostException 
 */
public static Server getServer(int port, String staticContent) throws UnknownHostException{
  Server webServer = new org.mortbay.jetty.Server();
  SocketConnector listener = new SocketConnector();
  listener.setPort(port);
  listener.setHost("127.0.0.1");
  webServer.addConnector(listener);
  ContextHandler staticContext = new ContextHandler();
  staticContext.setContextPath("/");
  staticContext.setResourceBase(staticContent);
  staticContext.addHandler(new ResourceHandler());
  webServer.addHandler(staticContext);
  return webServer;
}
 
开发者ID:yahoo,项目名称:anthelion,代码行数:21,代码来源:CrawlDBTestUtil.java

示例5: startServer

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
/**
 * Start embedded server.
 * @throws Exception
 */
public void startServer() throws Exception {
    SocketConnector connector = new SocketConnector();
    connector.setPort(0);
    connector.setHost("127.0.0.1");
    webServer.addConnector(connector);

    webServer.start();
    port = connector.getLocalPort();
    host = connector.getHost();
}
 
开发者ID:eBay,项目名称:oink,代码行数:15,代码来源:ServletTestContext.java

示例6: createListeners

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
private void createListeners() 
{
    SocketConnector connector = new SocketConnector();
    connector.setPort(port);
    connector.setHost(hostname);
    connector.setName(Messages.getString("WebServer.Log.KettleHTTPListener",hostname));
    log.logBasic(toString(), Messages.getString("WebServer.Log.CreateListener",hostname,""+port));

    server.setConnectors( new Connector[] { connector });
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:11,代码来源:WebServer.java

示例7: go

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
public void go() {
  QueuedThreadPool pool = new QueuedThreadPool();
  pool.setMinThreads(2); // debug server doesn't need many threads.
  pool.setMaxThreads(10);
  pool.setName("DebugServer(port" + port + ")");
  pool.setDaemon(true);
  server.setThreadPool(pool);
  SocketConnector connector = new SocketConnector();

  connector.setPort(port);
  connector.setHost(host);
  connector.setMaxIdleTime(60000); // 1 min
  server.addConnector(connector);

  context.setContextPath("/");
  context.setBaseResource(Resource.newClassPathResource("/org/cloudera/stethoscope"));
  server.setHandler(context);

  addServlet(new DefaultServlet(), "/");
  addServlet(new DataServlet(), "/json/*");
  addServlet(new TracerServlet(inst), "/tracer/*");
  addServlet(new EvaluateServlet(), "/evaluate");
  addServlet(new PoorMansProfileServlet(), "/poorMansProfiler");
  addServlet(new JMXJsonServlet(), "/jmx");
  
  // addServlet(new LoggerServlet(), "/logging");
  
  try {
    server.start();
  } catch (Exception e) {
    // avoiding logging in this context.
    e.printStackTrace(System.err);
  }
}
 
开发者ID:philz,项目名称:stethoscope,代码行数:35,代码来源:StethoscopeWebServer.java

示例8: createListeners

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
private void createListeners() 
{
    SocketConnector connector = new SocketConnector();
    connector.setPort(port);
    connector.setHost(hostname);
    connector.setName(BaseMessages.getString(PKG, "WebServer.Log.KettleHTTPListener",hostname));
    log.logBasic(BaseMessages.getString(PKG, "WebServer.Log.CreateListener",hostname,""+port));

    server.setConnectors( new Connector[] { connector });
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:WebServer.java

示例9: createListeners

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
private void createListeners() {
  SocketConnector connector = new SocketConnector();
  connector.setPort(port);
  connector.setHost(hostname);
  connector.setName(BaseMessages.getString(PKG, "WebServer.Log.KettleHTTPListener", hostname));
  log.logBasic(BaseMessages.getString(PKG, "WebServer.Log.CreateListener", hostname, "" + port));

  server.setConnectors(new Connector[] { connector });
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:10,代码来源:WebServer.java

示例10: createConnector

import org.mortbay.jetty.bio.SocketConnector; //导入方法依赖的package包/类
private static Connector createConnector(HostAndPort address) {
  SocketConnector connector = new SocketConnector();
  connector.setHost(address.getHost());
  connector.setPort(address.getPortOrDefault(DEFAULT_PORT));
  return connector;
}
 
开发者ID:google,项目名称:nomulus,代码行数:7,代码来源:TestServer.java


注:本文中的org.mortbay.jetty.bio.SocketConnector.setHost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。