Persoenliche Mediazentrale
ulrich
2021-04-21 5c621434b008d1671accfc4b9c9c9016a256fd9f
src/de/uhilger/mediaz/Server.java
@@ -19,7 +19,10 @@
import com.sun.net.httpserver.HttpServer;
import de.uhilger.mediaz.api.FileHandler;
import de.uhilger.mediaz.api.GeraetSteuerung;
import de.uhilger.mediaz.api.ListFileHandler;
import de.uhilger.mediaz.api.ListHandler;
import de.uhilger.mediaz.api.MediaSteuerung;
import de.uhilger.mediaz.api.StopServerHandler;
import de.uhilger.mediaz.api.StorageHandler;
import de.uhilger.mediaz.store.FileStorage;
@@ -48,11 +51,14 @@
  public static final String RB_SERVER_START_MSG = "msgServerStart";
  public static final String RB_WEBROOT = "webroot";
  public static final String RB_STORE = "store";
  public static final String RB_STRG = "strg";
  public static final String RB_GSTRG = "gstrg";
  public static final String RB_ALIST= "alist";
  //public static final String RB_UI_ROOT = "uiroot";
  public static final String RB_STOP_SERVER = "stopServer";
  //public static final String RB_ABLAGE_TEST = "testAblage";
  //public static final String RB_STORE_TEST = "testStore";
  public static final String RB_SLASH = "slash";
  public static final String SLASH = "/";
  private int port;
@@ -83,9 +89,8 @@
   * @param ctxName Name des Kontexts, unter dem der Server aufrufbar sein soll
   */
  public void setContextName(String ctxName) {
    String slash = App.getRs(RB_SLASH);
    if (!ctxName.startsWith(slash)) {
      this.ctx = slash + ctxName;
    if (!ctxName.startsWith(SLASH)) {
      this.ctx = SLASH + ctxName;
    } else {
      this.ctx = ctxName;
    }
@@ -109,6 +114,9 @@
    server.createContext(ctx + App.getRs(RB_WEBROOT), new FileHandler(wwwDir.getAbsolutePath()));
    ablageorteEinklinken(server);
    server.createContext(ctx + App.getRs(RB_STORE), new StorageHandler());
    server.createContext(ctx + App.getRs(RB_STRG), new MediaSteuerung());
    server.createContext(ctx + App.getRs(RB_GSTRG), new GeraetSteuerung());
    server.createContext(ctx + App.getRs(RB_ALIST), new ListHandler());
    server.createContext(ctx + App.getRs(RB_STOP_SERVER), new StopServerHandler());
    server.setExecutor(Executors.newFixedThreadPool(20));
    server.start();