From 5216c437a3aa95a22a603ff91126fb944b2da0a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 30 Mar 2017 13:23:47 +0200 Subject: java : vaadin : factorise url output --- java/vaadin/src/run/java/ch/asynk/Main.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/java/vaadin/src/run/java/ch/asynk/Main.java b/java/vaadin/src/run/java/ch/asynk/Main.java index 005ac9c..65a0af6 100644 --- a/java/vaadin/src/run/java/ch/asynk/Main.java +++ b/java/vaadin/src/run/java/ch/asynk/Main.java @@ -44,6 +44,11 @@ abstract class VaadinJettyServer extends Server setHandler(context); } + protected void say(int port, boolean https) + { + System.out.println(String.format("%s://localhost:%d/hello", (https ? "https" : "http"), port)); + } + private ServletHolder buildVaadinServlet(VaadinServlet servlet, Class uiClass) { ServletHolder servletHolder = new ServletHolder(servlet); @@ -84,7 +89,7 @@ class HttpVaadinJettyServer extends VaadinJettyServer @Override protected void configure(int port) { - System.out.println("http://localhost:" + port + "/hello"); + say(port, false); addConnector(httpConnector(port)); } } @@ -96,7 +101,7 @@ class HttpsVaadinJettyServer extends VaadinJettyServer @Override protected void configure(int port) { - System.out.println("https://localhost:" + port + "/hello"); + say(port, true); addConnector(httpsConnector(port)); } } @@ -107,8 +112,8 @@ class HttpHttpsVaadinJettyServer extends HttpsVaadinJettyServer @Override protected void configure(int port) { - System.out.println("http://localhost:" + port + "/hello"); - System.out.println("https://localhost:" + (port + 1) + "/hello"); + say(port, false); + say(port + 1, true); this.setConnectors(new Connector[] { httpConnector(port), httpsConnector(port + 1) }); } } -- cgit v1.1-2-g2b99