From 9686c6d0bc82fe48d440f72e76dedb6a3317a10f Mon Sep 17 00:00:00 2001 From: Kalle Stenflo Date: Thu, 11 Sep 2014 15:25:59 +0200 Subject: [PATCH] Configured Heroku deploy --- Procfile | 2 +- json-path-web-test/pom.xml | 3 ++- .../main/java/com/jayway/jsonpath/web/boot/Main.java | 12 +++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Procfile b/Procfile index a9a06c29..cac0da37 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: java $JAVA_OPTS -Dserver.http.port=$PORT -jar web/build/distributions/trumpet-server-1.0.0-shadow.jar \ No newline at end of file +web: java $JAVA_OPTS -Dserver.http.port=$PORT -jar json-path-web-test/target/json-path-web-test-0.9.2-SNAPSHOT.one-jar.jar \ No newline at end of file diff --git a/json-path-web-test/pom.xml b/json-path-web-test/pom.xml index de3e8e94..ab5ebff5 100644 --- a/json-path-web-test/pom.xml +++ b/json-path-web-test/pom.xml @@ -14,7 +14,8 @@ UTF-8 0.4.0 - 0.25 + 0.25 + diff --git a/json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java b/json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java index 44ecb6a0..faebfa79 100644 --- a/json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java +++ b/json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java @@ -13,6 +13,7 @@ import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; +import java.awt.*; import java.io.IOException; @@ -20,19 +21,16 @@ import java.io.IOException; public class Main { public static void main(String[] args) throws Exception { - int port = 8080; + String configPort = "8080"; if(args.length > 0){ - try { - port = Integer.parseInt(args[0]); - } catch (NumberFormatException nfe) { - System.out.println("Invalid usage! Port argument must be an integer (if not supplied " + port + " is used)"); - } + configPort = args[0]; } + String port = System.getProperty("server.http.port", configPort); System.out.println("Server started on port: " + port); Server server = new Server(); - server.setConnectors(new Connector[]{createConnector(server, port)}); + server.setConnectors(new Connector[]{createConnector(server, Integer.parseInt(port))}); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); context.setContextPath("/api");