From c2c1fd263b9a72779df397f28c5bdd8f4d934524 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sat, 24 Apr 2021 10:49:55 +0000
Subject: [PATCH] Umbenannt zu Calypso

---
 src/de/uhilger/calypso/Server.java |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/de/uhilger/calypso/Server.java b/src/de/uhilger/calypso/Server.java
index d1064a1..a4dce04 100644
--- a/src/de/uhilger/calypso/Server.java
+++ b/src/de/uhilger/calypso/Server.java
@@ -43,6 +43,8 @@
 
   private int port;
   
+  private String contextName;
+  
   public Server(int port) {
     this.port = port;
   }
@@ -51,19 +53,27 @@
     this.port = port;
   }
   
+  /**
+   * 
+   * @param contextName e.g. '/calypso' or '/cal'
+   */
+  public void setContextName(String contextName) {
+    this.contextName = contextName;
+  }
+  
   public void start() throws IOException {
     logger.info("Server starting on port " + port);
 
     HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
-    server.createContext("/avd/play", new PlayHandler(OMXPlayer.F_PLAY));
-    server.createContext("/avd/seek", new SeekHandler(OMXPlayer.F_SEEK));
-    server.createContext("/avd/stop", new CmdHandler(OMXPlayer.CMD_STOP));
-    server.createContext("/avd/pause", new CmdHandler(OMXPlayer.CMD_PAUSE_RESUME));
-    server.createContext("/avd/ping", new PingHandler(OMXPlayer.F_PING));
-    server.createContext("/avd/server/stop", new StopServerHandler());
-    server.createContext("/avd/log", new LogHandler());
-    server.createContext("/avd/playon", new PlayOnHandler(OMXPlayer.F_PLAY_ON));
-    server.createContext("/avd/ui", new FileHandler(App.getInitParameter(App.IP_WWW_DATA)));
+    server.createContext(contextName + "/play", new PlayHandler(OMXPlayer.F_PLAY));
+    server.createContext(contextName + "/seek", new SeekHandler(OMXPlayer.F_SEEK));
+    server.createContext(contextName + "/stop", new CmdHandler(OMXPlayer.CMD_STOP));
+    server.createContext(contextName + "/pause", new CmdHandler(OMXPlayer.CMD_PAUSE_RESUME));
+    server.createContext(contextName + "/ping", new PingHandler(OMXPlayer.F_PING));
+    server.createContext(contextName + "/server/stop", new StopServerHandler());
+    server.createContext(contextName + "/log", new LogHandler());
+    server.createContext(contextName + "/playon", new PlayOnHandler(OMXPlayer.F_PLAY_ON));
+    server.createContext(contextName + "/ui", new FileHandler(App.getInitParameter(App.IP_WWW_DATA)));
     //server.setExecutor(null); // creates a default executor
     server.setExecutor(Executors.newFixedThreadPool(20));
     server.start();

--
Gitblit v1.9.3