From b8755af7192a8f3677c5ce89c3557006a70d014c Mon Sep 17 00:00:00 2001 From: Chirag Jayswal Date: Sun, 2 Oct 2022 23:09:50 -0700 Subject: [PATCH] added property to set port, default value 2612 --- src/com/qmetry/qaf/automation/tools/RepoEditor.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/qmetry/qaf/automation/tools/RepoEditor.java b/src/com/qmetry/qaf/automation/tools/RepoEditor.java index 897e637f..917e55c0 100644 --- a/src/com/qmetry/qaf/automation/tools/RepoEditor.java +++ b/src/com/qmetry/qaf/automation/tools/RepoEditor.java @@ -55,9 +55,13 @@ public class RepoEditor { * @param args */ public static void main(String[] args) { - final HttpServer server = createServer(); + int port = ConfigurationManager.getBundle().getInt("repoeditor.server.port",2612); + final HttpServer server = createServer(port); try { server.start(); + System.out.println("server started on port: " + port); + System.out.println("type \"exit\" to stop server."); + try (Scanner s = new Scanner(System.in)) { s.next("exit"); } @@ -68,8 +72,8 @@ public static void main(String[] args) { } @SuppressWarnings("unchecked") - private static HttpServer createServer() { - HttpServer server = ServerBootstrap.bootstrap().setListenerPort(8080).register("/", (req, res, c) -> { + private static HttpServer createServer(int port) { + HttpServer server = ServerBootstrap.bootstrap().setListenerPort(port).register("/", (req, res, c) -> { res.setEntity(new FileEntity(new File("dashboard.htm"), ContentType.TEXT_HTML)); }).register("/browse", (req, res, c) -> { res.setEntity(new StringEntity(browse("."), ContentType.TEXT_HTML));