org.h2.server.web.WebServer.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(170)

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

WebServer.<init>介绍

暂无

代码示例

代码示例来源:origin: com.h2database/h2

@Override
public void init() {
  ServletConfig config = getServletConfig();
  Enumeration<?> en = config.getInitParameterNames();
  ArrayList<String> list = New.arrayList();
  while (en.hasMoreElements()) {
    String name = en.nextElement().toString();
    String value = config.getInitParameter(name);
    if (!name.startsWith("-")) {
      name = "-" + name;
    }
    list.add(name);
    if (value.length() > 0) {
      list.add(value);
    }
  }
  String[] args = list.toArray(new String[0]);
  server = new WebServer();
  server.setAllowChunked(false);
  server.init(args);
}

代码示例来源:origin: com.h2database/h2

/**
 * Create a new web server, but does not start it yet. Example:
 *
 * <pre>
 * Server server = Server.createWebServer("-trace").start();
 * </pre>
 * Supported options are:
 * -webPort, -webSSL, -webAllowOthers, -webDaemon,
 * -trace, -ifExists, -baseDir, -properties.
 * See the main method for details.
 *
 * @param args the argument list
 * @return the server
 */
public static Server createWebServer(String... args) throws SQLException {
  WebServer service = new WebServer();
  Server server = new Server(service, args);
  service.setShutdownHandler(server);
  return server;
}

代码示例来源:origin: apache/ignite

/**
 * Start debug console if needed.
 *
 * @throws IgniteCheckedException If failed.
 */
private void startDebugConsole() throws IgniteCheckedException {
  try {
    if (getString(IGNITE_H2_DEBUG_CONSOLE) != null) {
      Connection c = DriverManager.getConnection(dbUrl);
      int port = getInteger(IGNITE_H2_DEBUG_CONSOLE_PORT, 0);
      WebServer webSrv = new WebServer();
      Server web = new Server(webSrv, "-webPort", Integer.toString(port));
      web.start();
      String url = webSrv.addSession(c);
      U.quietAndInfo(log, "H2 debug console URL: " + url);
      try {
        Server.openBrowser(url);
      }
      catch (Exception e) {
        U.warn(log, "Failed to open browser: " + e.getMessage());
      }
    }
  }
  catch (SQLException e) {
    throw new IgniteCheckedException(e);
  }
}

代码示例来源:origin: com.h2database/h2

WebServer webServer = new WebServer();
String[] args;
if (ignoreProperties) {

代码示例来源:origin: stackoverflow.com

includeOnce('./bin/WebServer.js');

function Lara() {
 this.webServer = new WebServer();
 this.webServer.start();
}

Lara.prototype.webServer = null;

module.exports.Lara = Lara;

代码示例来源:origin: com.h2database/com.springsource.org.h2

public void init() throws ServletException {
  ServletConfig config = getServletConfig();
  Enumeration en = config.getInitParameterNames();
  ArrayList list = new ArrayList();
  while (en.hasMoreElements()) {
    String name = en.nextElement().toString();
    String value = config.getInitParameter(name);
    if (!name.startsWith("-")) {
      name = "-" + name;
    }
    list.add(name);
    if (value.length() > 0) {
      list.add(value);
    }
  }
  String[] args = new String[list.size()];
  list.toArray(args);
  server = new WebServer();
  try {
    server.init(args);
  } catch (Exception e) {
    throw new ServletException("Init failed", e);
  }
}

代码示例来源:origin: org.leapframework/jmms-engine

@Override
public void init(ServletConfig config) throws ServletException {
  server = new WebServer();
  server.setAllowChunked(false);
  server.init(new String[]{});
}

代码示例来源:origin: org.wowtools/h2

@Override
public void init() {
  ServletConfig config = getServletConfig();
  Enumeration<?> en = config.getInitParameterNames();
  ArrayList<String> list = New.arrayList();
  while (en.hasMoreElements()) {
    String name = en.nextElement().toString();
    String value = config.getInitParameter(name);
    if (!name.startsWith("-")) {
      name = "-" + name;
    }
    list.add(name);
    if (value.length() > 0) {
      list.add(value);
    }
  }
  String[] args = new String[list.size()];
  list.toArray(args);
  server = new WebServer();
  server.setAllowChunked(false);
  server.init(args);
}

代码示例来源:origin: com.eventsourcing/h2

@Override
public void init() {
  ServletConfig config = getServletConfig();
  Enumeration<?> en = config.getInitParameterNames();
  ArrayList<String> list = New.arrayList();
  while (en.hasMoreElements()) {
    String name = en.nextElement().toString();
    String value = config.getInitParameter(name);
    if (!name.startsWith("-")) {
      name = "-" + name;
    }
    list.add(name);
    if (value.length() > 0) {
      list.add(value);
    }
  }
  String[] args = new String[list.size()];
  list.toArray(args);
  server = new WebServer();
  server.setAllowChunked(false);
  server.init(args);
}

代码示例来源:origin: org.wowtools/h2

/**
 * Create a new web server, but does not start it yet. Example:
 *
 * <pre>
 * Server server = Server.createWebServer("-trace").start();
 * </pre>
 * Supported options are:
 * -webPort, -webSSL, -webAllowOthers, -webDaemon,
 * -trace, -ifExists, -baseDir, -properties.
 * See the main method for details.
 *
 * @param args the argument list
 * @return the server
 */
public static Server createWebServer(String... args) throws SQLException {
  WebServer service = new WebServer();
  Server server = new Server(service, args);
  service.setShutdownHandler(server);
  return server;
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

/**
 * Create a new web server, but does not start it yet. Example:
 * 
 * <pre>
 * Server server = Server.createWebServer(
 *     new String[] { &quot;-trace&quot; }).start();
 * </pre>
 * 
 * @param args
 * @return the server
 */
public static Server createWebServer(String[] args) throws SQLException {
  WebServer service = new WebServer();
  Server server = new Server(service, args);
  service.setShutdownHandler(server);
  return server;
}

代码示例来源:origin: com.eventsourcing/h2

/**
 * Create a new web server, but does not start it yet. Example:
 *
 * <pre>
 * Server server = Server.createWebServer("-trace").start();
 * </pre>
 * Supported options are:
 * -webPort, -webSSL, -webAllowOthers, -webDaemon,
 * -trace, -ifExists, -baseDir, -properties.
 * See the main method for details.
 *
 * @param args the argument list
 * @return the server
 */
public static Server createWebServer(String... args) throws SQLException {
  WebServer service = new WebServer();
  Server server = new Server(service, args);
  service.setShutdownHandler(server);
  return server;
}

代码示例来源:origin: org.wowtools/h2

/**
 * Start a web server and a browser that uses the given connection. The
 * current transaction is preserved. This is specially useful to manually
 * inspect the database when debugging. This method return as soon as the
 * user has disconnected.
 *
 * @param conn the database connection (the database must be open)
 */
public static void startWebServer(Connection conn) throws SQLException {
  WebServer webServer = new WebServer();
  Server web = new Server(webServer, new String[] { "-webPort", "0" });
  web.start();
  Server server = new Server();
  server.web = web;
  webServer.setShutdownHandler(server);
  String url = webServer.addSession(conn);
  try {
    Server.openBrowser(url);
    while (!webServer.isStopped()) {
      Thread.sleep(1000);
    }
  } catch (Exception e) {
    // ignore
  }
}

代码示例来源:origin: com.eventsourcing/h2

/**
 * Start a web server and a browser that uses the given connection. The
 * current transaction is preserved. This is specially useful to manually
 * inspect the database when debugging. This method return as soon as the
 * user has disconnected.
 *
 * @param conn the database connection (the database must be open)
 */
public static void startWebServer(Connection conn) throws SQLException {
  WebServer webServer = new WebServer();
  Server web = new Server(webServer, new String[] { "-webPort", "0" });
  web.start();
  Server server = new Server();
  server.web = web;
  webServer.setShutdownHandler(server);
  String url = webServer.addSession(conn);
  try {
    Server.openBrowser(url);
    while (!webServer.isStopped()) {
      Thread.sleep(1000);
    }
  } catch (Exception e) {
    // ignore
  }
}

代码示例来源:origin: org.gridgain/gridgain-indexing

Connection c = DriverManager.getConnection(dbUrl);
WebServer webSrv = new WebServer();
Server web = new Server(webSrv, "-webPort", "0");
web.start();

相关文章