refactor: expose local application server port
This commit is contained in:
parent
27e8335f79
commit
94aba370e0
1 changed files with 17 additions and 21 deletions
|
@ -28,11 +28,7 @@ public class SPdfApplication {
|
||||||
|
|
||||||
if (browserOpen) {
|
if (browserOpen) {
|
||||||
try {
|
try {
|
||||||
String port = env.getProperty("local.server.port");
|
String url = "http://localhost:" + getPort();
|
||||||
if(port == null || port.length() == 0) {
|
|
||||||
port="8080";
|
|
||||||
}
|
|
||||||
String url = "http://localhost:" + port;
|
|
||||||
|
|
||||||
String os = System.getProperty("os.name").toLowerCase();
|
String os = System.getProperty("os.name").toLowerCase();
|
||||||
Runtime rt = Runtime.getRuntime();
|
Runtime rt = Runtime.getRuntime();
|
||||||
|
@ -66,17 +62,17 @@ public class SPdfApplication {
|
||||||
GeneralUtils.createDir("customFiles/static/");
|
GeneralUtils.createDir("customFiles/static/");
|
||||||
GeneralUtils.createDir("customFiles/templates/");
|
GeneralUtils.createDir("customFiles/templates/");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("Stirling-PDF Started.");
|
System.out.println("Stirling-PDF Started.");
|
||||||
|
|
||||||
String port = System.getProperty("local.server.port");
|
String url = "http://localhost:" + getPort();
|
||||||
if(port == null || port.length() == 0) {
|
|
||||||
port="8080";
|
|
||||||
}
|
|
||||||
String url = "http://localhost:" + port;
|
|
||||||
System.out.println("Navigate to " + url);
|
System.out.println("Navigate to " + url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getPort() {
|
||||||
|
String port = System.getProperty("local.server.port");
|
||||||
|
if (port == null || port.isEmpty()) {
|
||||||
|
port = "8080";
|
||||||
|
}
|
||||||
|
return port;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue