Skip to content

Commit 15974c9

Browse files
committed
Added support for -p command line arg in the startServer() method in the Utils class
1 parent ad6ae39 commit 15974c9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/javaxt/demo/express/Utils.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package javaxt.demo.express;
22

33
import java.util.HashMap;
4+
import static javaxt.utils.Console.*;
45
import javaxt.http.servlet.HttpServlet;
56

67
public class Utils {
@@ -12,13 +13,10 @@ public class Utils {
1213
/** Used to start a web server
1314
*/
1415
public static void startServer(HashMap<String, String> args, HttpServlet servlet){
15-
16-
int port = 9080;
17-
try{ port = Integer.parseInt(args.get("-port")); }catch(Exception e){}
16+
Integer port = getValue(args, "-port", "-p").toInteger();
17+
if (port==null) port = 9080;
1818
int numThreads = 250;
1919
new javaxt.http.Server(port, numThreads, servlet).start();
20-
21-
System.out.println("Started server!");
2220
}
2321

2422
}

0 commit comments

Comments
 (0)