diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-03-30 13:23:47 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-03-30 13:23:47 +0200 |
commit | 5216c437a3aa95a22a603ff91126fb944b2da0a0 (patch) | |
tree | d5342cf1fc583db26883a5a6f7132d86021fd014 | |
parent | 03a23b0d6c7529b07484954d44235bceb279fd24 (diff) | |
download | share-5216c437a3aa95a22a603ff91126fb944b2da0a0.zip share-5216c437a3aa95a22a603ff91126fb944b2da0a0.tar.gz |
java : vaadin : factorise url output
-rw-r--r-- | java/vaadin/src/run/java/ch/asynk/Main.java | 13 |
1 files 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<? extends UI> 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) }); } } |