From 8771ec89633aff2040c8e9c9b25c98778f19bedb Mon Sep 17 00:00:00 2001 From: undisclosed Date: Fri, 30 Dec 2022 10:20:07 +0000 Subject: [PATCH] Readme angepasst --- src/de/uhilger/calypso/Server.java | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/de/uhilger/calypso/Server.java b/src/de/uhilger/calypso/Server.java index d1064a1..6a11452 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,30 @@ 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 + "/vol-inc", new CmdHandler(OMXPlayer.CMD_INC_VOL)); + server.createContext(contextName + "/vol-dec", new CmdHandler(OMXPlayer.CMD_DEC_VOL)); + server.createContext(contextName + "/info", new CmdHandler(OMXPlayer.CMD_TOGGLE_INFO)); + 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