提交 3ab628ff authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Add optional parameter to Server.startWebServer() to ignore user's properties

上级 b2385b24
......@@ -706,8 +706,27 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
* @param conn the database connection (the database must be open)
*/
public static void startWebServer(Connection conn) throws SQLException {
startWebServer(conn, false);
}
/**
* 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)
* @param ignoreProperties if {@code true} properties from
* {@code .h2.server.properties} will be ignored
*/
public static void startWebServer(Connection conn, boolean ignoreProperties) throws SQLException {
WebServer webServer = new WebServer();
Server web = new Server(webServer, new String[] { "-webPort", "0" });
String[] args;
if (ignoreProperties)
args = new String[] { "-webPort", "0", "-properties", "null"};
else
args = new String[] { "-webPort", "0" };
Server web = new Server(webServer, args);
web.start();
Server server = new Server();
server.web = web;
......
......@@ -557,7 +557,7 @@ public class TestWeb extends TestBase {
Task t = new Task() {
@Override
public void call() throws Exception {
Server.startWebServer(conn);
Server.startWebServer(conn, true);
}
};
t.execute();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论