From 2b6134e50801f9fc66a27a2d565340f5773f251f Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sun, 04 Apr 2021 11:24:49 +0000
Subject: [PATCH] ResourceBundle eingebaut

---
 src/de/uhilger/mediaz/api/StopServerHandler.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/de/uhilger/mediaz/handler/StopServerHandler.java b/src/de/uhilger/mediaz/api/StopServerHandler.java
similarity index 79%
rename from src/de/uhilger/mediaz/handler/StopServerHandler.java
rename to src/de/uhilger/mediaz/api/StopServerHandler.java
index d910470..78826d7 100644
--- a/src/de/uhilger/mediaz/handler/StopServerHandler.java
+++ b/src/de/uhilger/mediaz/api/StopServerHandler.java
@@ -15,7 +15,7 @@
   You should have received a copy of the GNU Affero General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
-package de.uhilger.mediaz.handler;
+package de.uhilger.mediaz.api;
 
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpHandler;
@@ -32,6 +32,14 @@
  * @author Ulrich Hilger
  */
 public class StopServerHandler implements HttpHandler {
+  
+  /* Der Logger fuer diesen StopServerHandler */
+  private static final Logger logger = Logger.getLogger(StopServerHandler.class.getName());
+  
+  /* ResourceBundle-Kennungen */
+  public static final String RB_STOPPING_SERVER = "stoppingServer";
+  public static final String RB_SERVER_STOPPED = "serverStopped";
+  public static final String RB_MEDIAZ_END = "mediazEnd";
 
   /**
    * Den Server geordnet herunterfahren und 
@@ -44,13 +52,13 @@
   @Override
   public void handle(HttpExchange e) throws IOException {
     Logger.getLogger(StopServerHandler.class.getName()).info(e.getRequestURI().toString());
-    String response = "Server stopped";
+    String response = App.getRs(RB_SERVER_STOPPED);
     e.sendResponseHeaders(200, response.length());
     OutputStream os = e.getResponseBody();
     os.write(response.getBytes());
     os.flush();
     os.close();
-    Logger.getLogger(StopServerHandler.class.getName()).info("stopping server.");
+    logger.info(App.getRs(RB_STOPPING_SERVER));
     e.getHttpContext().getServer().stop(1);
     Timer timer = new Timer();
     timer.schedule(new AppStopper(), 2000);
@@ -64,7 +72,7 @@
 
     @Override
     public void run() {
-      Logger.getLogger(StopServerHandler.class.getName()).info("Mediazentrale beendet.");
+      logger.info(App.getRs(RB_MEDIAZ_END));
       App.stop();
     }
   }

--
Gitblit v1.9.3