|
@@ -1,111 +1,115 @@
|
|
|
-/*
|
|
|
- * Copyright (C) 2015 iZc
|
|
|
- *
|
|
|
- * This program is free software: you can redistribute it and/or modify
|
|
|
- * it under the terms of the GNU General Public License as published by
|
|
|
- * the Free Software Foundation, either version 3 of the License, or
|
|
|
- * (at your option) any later version.
|
|
|
- *
|
|
|
- * This program is distributed in the hope that it will be useful,
|
|
|
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
- * GNU General Public License for more details.
|
|
|
- *
|
|
|
- * You should have received a copy of the GNU General Public License
|
|
|
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
- */
|
|
|
-package de.nplusc.izc.iZpl;
|
|
|
-
|
|
|
-import com.sun.net.httpserver.HttpServer;
|
|
|
-import de.nplusc.izc.tools.baseTools.Messagers;
|
|
|
-import java.io.IOException;
|
|
|
-import java.net.BindException;
|
|
|
-import java.net.InetSocketAddress;
|
|
|
-import org.apache.logging.log4j.LogManager;
|
|
|
-import org.apache.logging.log4j.Logger;
|
|
|
-
|
|
|
-/**
|
|
|
- *
|
|
|
- * @author LH
|
|
|
- */
|
|
|
-public class PLServer
|
|
|
-{
|
|
|
- private static final Logger l = LogManager.getLogger();
|
|
|
- public static PlProcessorV2 ppp=null;
|
|
|
-
|
|
|
- public PlProcessorV2 getPlProcessorV2()
|
|
|
- {
|
|
|
- return ppp;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public PLServer(String plPath)
|
|
|
- {
|
|
|
- this(plPath, true);
|
|
|
- }
|
|
|
-
|
|
|
- public PLServer(String plPath,boolean serverOn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- ppp = new PlProcessorV2();
|
|
|
- ppp.InitializeOnPath(plPath);
|
|
|
- if(serverOn)
|
|
|
- {
|
|
|
- l.info("Serving");
|
|
|
- HttpServer server = HttpServer.create(new InetSocketAddress("localhost",9263), 0);//,InetAddress.getByName("localhost"));
|
|
|
- server.createContext("/", ppp);//nimmt jeden beliebigen namen an
|
|
|
- server.createContext("/reload",new ReloadMgr(ppp));
|
|
|
- server.createContext("/rcvr",new ReInitializer());
|
|
|
- server.createContext("/edit",new EditorLoader());
|
|
|
- server.setExecutor(null); // creates a default executor
|
|
|
- server.start();
|
|
|
- }
|
|
|
- }
|
|
|
- catch(BindException xxx)
|
|
|
- {
|
|
|
- Messagers.SingleLineMsg("iZpl bereits gestartt; keine 2 instanzen möglich", "OKAY");
|
|
|
- System.exit(9263);
|
|
|
- }
|
|
|
- catch (IOException ex)
|
|
|
- {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public PLServer(PlProcessorV2 pp)
|
|
|
- {
|
|
|
- this(pp, true);
|
|
|
- }
|
|
|
-
|
|
|
- public PLServer(PlProcessorV2 pp,boolean serverOn)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- ppp=pp;
|
|
|
- if(serverOn)
|
|
|
- {
|
|
|
- HttpServer server = HttpServer.create(new InetSocketAddress("localhost",9263), 0);//,InetAddress.getByName("localhost"));
|
|
|
- server.createContext("/", pp);//nimmt jeden beliebigen namen an
|
|
|
- server.createContext("/reload",new ReloadMgr(ppp));
|
|
|
- server.createContext("/rcvr",new ReInitializer());
|
|
|
- server.createContext("/edit",new EditorLoader());
|
|
|
- server.setExecutor(null); // creates a default executor
|
|
|
- server.start();
|
|
|
- }
|
|
|
- }
|
|
|
- catch(BindException xxx)
|
|
|
- {
|
|
|
- Messagers.SingleLineMsg("iZpl bereits gestartt; keine 2 instanzen möglich", "OKAY");
|
|
|
- System.exit(9263);
|
|
|
- }
|
|
|
- catch (IOException ex)
|
|
|
- {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+/*
|
|
|
+ * Copyright (C) 2015 iZc
|
|
|
+ *
|
|
|
+ * This program is free software: you can redistribute it and/or modify
|
|
|
+ * it under the terms of the GNU General Public License as published by
|
|
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
|
+ * (at your option) any later version.
|
|
|
+ *
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+ * GNU General Public License for more details.
|
|
|
+ *
|
|
|
+ * You should have received a copy of the GNU General Public License
|
|
|
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
+ */
|
|
|
+package de.nplusc.izc.iZpl;
|
|
|
+
|
|
|
+import com.sun.net.httpserver.HttpServer;
|
|
|
+import de.nplusc.izc.tools.baseTools.Messagers;
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.BindException;
|
|
|
+import java.net.InetSocketAddress;
|
|
|
+import java.util.HashMap;
|
|
|
+import org.apache.logging.log4j.LogManager;
|
|
|
+import org.apache.logging.log4j.Logger;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author LH
|
|
|
+ */
|
|
|
+public class PLServer
|
|
|
+{
|
|
|
+ private static final Logger l = LogManager.getLogger();
|
|
|
+ public static PlProcessorV2 ppp=null;
|
|
|
+
|
|
|
+ public PlProcessorV2 getPlProcessorV2()
|
|
|
+ {
|
|
|
+ return ppp;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public PLServer(String plPath)
|
|
|
+ {
|
|
|
+ this(plPath, true, new HashMap<String,String>());
|
|
|
+ }
|
|
|
+
|
|
|
+ public PLServer(String plPath,boolean serverOn,HashMap<String,String> options)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ ppp = new PlProcessorV2();
|
|
|
+ ppp.setOptions(options);
|
|
|
+ ppp.InitializeOnPath(plPath);
|
|
|
+ if(serverOn)
|
|
|
+ {
|
|
|
+ l.info("Serving");
|
|
|
+ HttpServer server = HttpServer.create(new InetSocketAddress("localhost",9263), 0);//,InetAddress.getByName("localhost"));
|
|
|
+ server.createContext("/", ppp);//nimmt jeden beliebigen namen an
|
|
|
+ server.createContext("/reload",new ReloadMgr(ppp));
|
|
|
+ server.createContext("/rcvr",new ReInitializer());
|
|
|
+ server.createContext("/edit",new EditorLoader());
|
|
|
+ server.setExecutor(null); // creates a default executor
|
|
|
+ server.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(BindException xxx)
|
|
|
+ {
|
|
|
+ l.fatal("ERROR, Port already taken");
|
|
|
+ Messagers.SingleLineMsg("iZpl bereits gestartt; keine 2 instanzen möglich", "OKAY");
|
|
|
+ System.exit(9263);
|
|
|
+ }
|
|
|
+ catch (IOException ex)
|
|
|
+ {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public PLServer(PlProcessorV2 pp)
|
|
|
+ {
|
|
|
+ this(pp, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ public PLServer(PlProcessorV2 pp,boolean serverOn)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ ppp=pp;
|
|
|
+ if(serverOn)
|
|
|
+ {
|
|
|
+ HttpServer server = HttpServer.create(new InetSocketAddress("localhost",9263), 0);//,InetAddress.getByName("localhost"));
|
|
|
+ server.createContext("/", pp);//nimmt jeden beliebigen namen an
|
|
|
+ server.createContext("/reload",new ReloadMgr(ppp));
|
|
|
+ server.createContext("/rcvr",new ReInitializer());
|
|
|
+ server.createContext("/edit",new EditorLoader());
|
|
|
+ server.setExecutor(null); // creates a default executor
|
|
|
+ server.start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(BindException xxx)
|
|
|
+ {
|
|
|
+ l.fatal("ERROR, Port already taken");
|
|
|
+ Messagers.SingleLineMsg("iZpl bereits gestartt; keine 2 instanzen möglich", "OKAY");
|
|
|
+ System.exit(9263);
|
|
|
+ }
|
|
|
+ catch (IOException ex)
|
|
|
+ {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|