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

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

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

WebServer.addSession介绍

[英]Create a session with a given connection.
[中]

代码示例

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

server.web = web;
webServer.setShutdownHandler(server);
String url = webServer.addSession(conn);
try {
  Server.openBrowser(url);

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

Server web = new Server(webSrv, "-webPort", "0");
web.start();
String url = webSrv.addSession(c);

相关文章