diff --git a/CloudAppManagerSimple/.gitignore b/CloudAppManagerSimple/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..11415f62a08ea7256d95749135d1fb90498cafa4
--- /dev/null
+++ b/CloudAppManagerSimple/.gitignore
@@ -0,0 +1 @@
+cloudapp*
diff --git a/ScenariMicroservizio/res/CONF/zona.json b/ScenariMicroservizio/res/CONF/zona.json
index bc770dab033be1db67ae3bbfa10f8a0b142d97ae..7a6bdfbbb3304acdaeae0731f38e8c25639a0e81 100644
--- a/ScenariMicroservizio/res/CONF/zona.json
+++ b/ScenariMicroservizio/res/CONF/zona.json
@@ -1,3 +1,3 @@
 {"attiva-scenari":"IN0",
 "learn-trigger":"IN4",
-"luce-antifurto":"OUT1"}
+"luce-antifurto":"OUT0"}
diff --git a/WebServer/bin/code/Helper.class b/WebServer/bin/code/Helper.class
index 6bd7d5b6b5b7978e5a12b325d22e6157c128e468..3300cb13fbfd27a0e2c9a4a3da8df66e7e5040bf 100644
Binary files a/WebServer/bin/code/Helper.class and b/WebServer/bin/code/Helper.class differ
diff --git a/WebServer/bin/code/Home.class b/WebServer/bin/code/Home.class
index 6c09f94b09cb75af9bab8e792360c2f0e093960d..f3684190f0f55f28da72773e5c8c571f7d4ed731 100644
Binary files a/WebServer/bin/code/Home.class and b/WebServer/bin/code/Home.class differ
diff --git a/WebServer/bin/code/ImageRes.class b/WebServer/bin/code/ImageRes.class
index dbea630fa79283942da8b0301e7d631ba032c7a8..c13d555803e889f009199779747dd92ec6f25b9e 100644
Binary files a/WebServer/bin/code/ImageRes.class and b/WebServer/bin/code/ImageRes.class differ
diff --git a/WebServer/bin/code/ObtainToken.class b/WebServer/bin/code/ObtainToken.class
index cebfebf5f5c5a64fbcf426c8d9f7ccfdaa558342..f258decf5d5f4e59bd514dc2d781544c5545e6f0 100644
Binary files a/WebServer/bin/code/ObtainToken.class and b/WebServer/bin/code/ObtainToken.class differ
diff --git a/WebServer/bin/code/Resources.class b/WebServer/bin/code/Resources.class
index ff670eb776da0489f96d95e76f6dfdefcd67c103..44be854e054a76e300164cafb98b46eb4538e98b 100644
Binary files a/WebServer/bin/code/Resources.class and b/WebServer/bin/code/Resources.class differ
diff --git a/WebServer/bin/code/Server$1.class b/WebServer/bin/code/Server$1.class
index 8a95613b4cd86c2f97bbaee3d062e54c890f425c..38daa28edacff85231424be273ee315ca437e914 100644
Binary files a/WebServer/bin/code/Server$1.class and b/WebServer/bin/code/Server$1.class differ
diff --git a/WebServer/bin/code/Server.class b/WebServer/bin/code/Server.class
index ba08391345eca2b494140003a57e34b886273b5b..ab3199cc984e3081670a07b24a4cff0f4914811a 100644
Binary files a/WebServer/bin/code/Server.class and b/WebServer/bin/code/Server.class differ
diff --git a/WebServer/src/code/Helper.java b/WebServer/src/code/Helper.java
index fb2dee8970030b6b2009dceb233f608428ba937e..2d1d155108606883e5168bb13a7cf473b9fc67d7 100644
--- a/WebServer/src/code/Helper.java
+++ b/WebServer/src/code/Helper.java
@@ -1,5 +1,8 @@
 package code;
 
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -12,45 +15,51 @@ import com.sun.net.httpserver.HttpsExchange;
 
 public class Helper {
 
-	public static void sendResponse(String response, HttpsExchange exchange) throws IOException {
-		System.out.println(response);
-		exchange.sendResponseHeaders(200, response.getBytes().length);
+	private static void sendResponse(HttpsExchange exchange, byte[] bytes, int code) throws IOException{
+		exchange.sendResponseHeaders(code, bytes.length);
 		OutputStream os = exchange.getResponseBody();
-		os.write(response.getBytes());
+		os.write(bytes);
 		os.close();
 	}
 
+	private static void sendResponse(HttpsExchange exchange, String response, int code) throws IOException{
+		sendResponse(exchange,response.getBytes(),code);
+	}
+
+	public static void sendResponseOk(String response, HttpsExchange exchange) throws IOException {
+		System.out.println(response);
+		sendResponse(exchange, response, 200);
+	}
+
+	public static void sendResponseOk(byte[] response, HttpsExchange exchange) throws IOException {
+		sendResponse(exchange, response, 200);
+	}
+
 	public static void badRequest(HttpsExchange exchange) throws IOException {
 		System.out.println("Errors in the request!");
-//		exchange.getResponseHeaders().remove("content-type");
 		String response = "{\"message\":\"Errors in the request!\"}";
-		exchange.sendResponseHeaders(400, response.getBytes().length);
-		OutputStream os = exchange.getResponseBody();
-		os.write(response.getBytes());
-		os.close();
+		sendResponse(exchange, response, 400);
 	}
 
 	public static void pageNotFound(HttpsExchange exchange) throws IOException {
 		System.out.println("Page not found!");
-//		exchange.getResponseHeaders().remove("content-type");
 		String response = "{\"message\":\"Page not found!\"}";
-		exchange.sendResponseHeaders(404, response.getBytes().length);
-		OutputStream os = exchange.getResponseBody();
-		os.write(response.getBytes());
-		os.close();
+		sendResponse(exchange, response, 404);
 	}
 
 	public static void methodNotAllowed(HttpsExchange exchange) throws IOException {
 		System.out.println("Method not allowed!");
-//		exchange.getResponseHeaders().remove("content-type");
 		String response = "{\"message\":\"Method not allowed!\"}";
-		exchange.sendResponseHeaders(405, response.getBytes().length);
-		OutputStream os = exchange.getResponseBody();
-		os.write(response.getBytes());
-		os.close();
+		sendResponse(exchange, response, 405);
+	}
+
+	public static void serverError(HttpsExchange exchange) throws IOException{
+		System.out.println("Server error!");
+		String response = "{\"message\":\"Server error!\"}";
+		sendResponse(exchange, response, 500);
 	}
 
-	public static boolean compareText(String a, String b){
+	public static boolean isSameString(String a, String b){
 		return a.compareToIgnoreCase(b) == 0;
 	}
 
@@ -74,4 +83,63 @@ public class Helper {
 			return false;
 		}
 	}
+
+	public static String getExtension(String file) {
+        int i = file.length() - 1;
+        while (i > 0 && file.charAt(i) != '.' && file.charAt(i) != '/')
+            i--;
+        if (file.charAt(i) == '.')
+            return file.substring(i + 1);
+        else
+            return "";
+    }
+
+	public static String getPageContents(String fileName){
+        String line;
+        String page = Server.CLIENT_PATH+(fileName.startsWith("/") ? fileName : "/"+fileName);
+
+        StringBuilder answer = new StringBuilder();
+        if (Helper.getExtension(page).length() == 0)
+            page += ".html";
+
+        BufferedReader bufferedReader = null;
+        try {
+            FileReader fileReader = new FileReader(page);
+
+            bufferedReader = new BufferedReader(fileReader);
+            boolean isComment = false;
+            while ((line = bufferedReader.readLine()) != null) {
+            	line = line.trim();
+
+            	if(line.startsWith("<!--") && line.endsWith("-->")) {
+            		continue;
+            	}
+            	if(line.startsWith("<!--")) {
+            		isComment = true;
+            		continue;
+            	}
+            	if(line.endsWith("-->")) {
+            		isComment = false;
+            		continue;
+            	}
+
+            	if(!isComment && line.length()>0)
+                	answer.append(line).append("\n");
+            }
+        } catch (FileNotFoundException ex) {
+            System.out.println("Unable to open file '" + page + "'");
+            return "fail";
+        } catch (IOException ex) {
+            System.out.println("Error reading file '" + page + "'");
+            return "fail";
+        } finally {
+            try{
+                if(bufferedReader != null)
+                    bufferedReader.close();
+            } catch (IOException ex){
+                System.out.println("Error closing bufferedReader");
+            }
+        }
+        return answer.toString();
+    }
 }
diff --git a/WebServer/src/code/Home.java b/WebServer/src/code/Home.java
index 7fe310e227fb2a2958466ffc60b15a77b458e1c7..14d55e43dfee6bb89cbe33a8871dbc5ddaec51b3 100644
--- a/WebServer/src/code/Home.java
+++ b/WebServer/src/code/Home.java
@@ -1,16 +1,9 @@
 package code;
 
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.json.JSONException;
-import org.json.JSONObject;
-
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpHandler;
 import com.sun.net.httpserver.HttpsExchange;
@@ -21,121 +14,19 @@ public class Home implements HttpHandler {
     public void handle(HttpExchange ex) throws IOException {
         HttpsExchange exchange = (HttpsExchange) ex;
         String requestMethod = exchange.getRequestMethod();
-        if (Helper.compareText(requestMethod, "GET")) {
-            List<String> strlist = new ArrayList<>();
-            String response = null;
-            response = getHomePage();
-            strlist.add("text/html");
-            if(response != null && !Helper.compareText(response, "fail")){
-                exchange.getResponseHeaders().put("content-type", strlist);
-                exchange.sendResponseHeaders(200, response.getBytes().length);
-                OutputStream os = exchange.getResponseBody();
-                os.write(response.getBytes());
-                os.close();
-            } else {
-                exchange.sendResponseHeaders(500, response.getBytes().length);
-                OutputStream os = exchange.getResponseBody();
-                os.write(response.getBytes());
-                os.close();
-            }
-        } else {
+        if (!Helper.isSameString(requestMethod, "GET")) {
             Helper.methodNotAllowed(exchange);
+            return;
         }
-    }
-
-    private static String getHomePage() {
-        String line;
-//        String pageIDString = pageid.toString();
-        String page = Server.CLIENT_PATH+"/index.html";// + pageIDString.substring(0, pageIDString.length() - 1) + ".txt";// entro nella cartella
-        // html e leggo il file
-        // txt
-
-        StringBuilder answer = new StringBuilder();
-        if (getExtension(page).length() == 0)
-            page += ".html";
-
-        BufferedReader bufferedReader = null;
-        try {
-            FileReader fileReader = new FileReader(page);
-
-            bufferedReader = new BufferedReader(fileReader);
-            boolean isComment = false;
-            while ((line = bufferedReader.readLine()) != null) {
-            	line = line.trim();
-
-            	if(line.startsWith("<!--") && line.endsWith("-->")) {
-            		continue;
-            	}
-            	if(line.startsWith("<!--")) {
-            		isComment = true;
-            		continue;
-            	}
-            	if(line.endsWith("-->")) {
-            		isComment = false;
-            		continue;
-            	}
-
-            	if(!isComment && line.length()>0)
-                	answer.append(line).append("\n");
-            }
-        } catch (FileNotFoundException ex) {
-            System.out.println("Unable to open file '" + page + "'");
-            return "fail";
-        } catch (IOException ex) {
-            System.out.println("Error reading file '" + page + "'");
-            return "fail";
-        } finally {
-            try{
-                if(bufferedReader != null)
-                    bufferedReader.close();
-            } catch (IOException ex){
-                System.out.println("Error closing bufferedReader");
-            }
-        }
-        return answer.toString();
-    }
-
-    private static String getKeycloak(){
-        String page = Server.CLIENT_PATH+"/keycloak.json";
-        BufferedReader bufferedReader = null;
-        StringBuilder answer = new StringBuilder();
-        try {
-            FileReader fileReader = new FileReader(page);
-            bufferedReader = new BufferedReader(fileReader);
-            String line;
-            while ((line = bufferedReader.readLine()) != null) {
-                answer.append(line.trim());
-            }
-
-            JSONObject js = new JSONObject(answer.toString());
-            return js.toString();
-        } catch (FileNotFoundException ex) {
-            System.out.println("Unable to open file '" + page + "'");
-            return "fail";
-        } catch (IOException ex) {
-            System.out.println("Error reading file '" + page + "'");
-            return "fail";
-        } catch (JSONException e) {
-            System.out.println("The file doesn't contain a JSON '" + page + "'");
-            return "fail";
-        } finally {
-            try{
-                if(bufferedReader != null)
-                    bufferedReader.close();
-            } catch (IOException ex){
-                System.out.println("Error closing bufferedReader");
-            }
+        String response = Helper.getPageContents("index.html");
+        if(response == null || Helper.isSameString(response, "fail")){
+            Helper.serverError(exchange);
+            return;
         }
-    }
-
-    private static String getExtension(String file) {
-        int i = file.length() - 1;
-        while (i > 0 && file.charAt(i) != '.' && file.charAt(i) != '/')
-            i--;
-        if (file.charAt(i) == '.')
-            return file.substring(i + 1);
-        else
-            return "";
+        List<String> strlist = new ArrayList<>();
+        strlist.add("text/html");
+        exchange.getResponseHeaders().put("content-type", strlist);
+        Helper.sendResponseOk(response, exchange);
     }
 
 }
\ No newline at end of file
diff --git a/WebServer/src/code/ImageRes.java b/WebServer/src/code/ImageRes.java
index 122d268da18b04aa5473cfa8f10fde1cee6a1c0f..827aa3dfc06aaac7534146bb64e28f6bb0fe18f9 100644
--- a/WebServer/src/code/ImageRes.java
+++ b/WebServer/src/code/ImageRes.java
@@ -4,15 +4,14 @@ import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.imageio.ImageIO;
 
 import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpsExchange;
 import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpsExchange;
 
 public class ImageRes implements HttpHandler {
 
@@ -22,24 +21,24 @@ public class ImageRes implements HttpHandler {
 		String requestURI = exchange.getRequestURI().toASCIIString().replace("/secured/home/", "/");
 
 		String requestMethod = exchange.getRequestMethod();
-		if (Helper.compareText(requestMethod, "GET")) {
-			BufferedImage image = getLocalImage(requestURI);
-			if (image == null)
-				Helper.pageNotFound(exchange);
-			List<String> strlist = new ArrayList<>();
-			strlist.add("image/png");
-			OutputStream os = exchange.getResponseBody();
-			ByteArrayOutputStream baos = new ByteArrayOutputStream();
-			ImageIO.write(image, "png", baos);
-			baos.flush();
-			byte[] imageInByte = baos.toByteArray();
-            exchange.getResponseHeaders().put("content-type", strlist);
-            exchange.sendResponseHeaders(200, imageInByte.length);
-			os.write(imageInByte);
-			os.close();
-		} else {
+		if (!Helper.isSameString(requestMethod, "GET")) {
 			Helper.methodNotAllowed(exchange);
+			return;
+		}
+		BufferedImage image = getLocalImage(requestURI);
+		if (image == null){
+			Helper.pageNotFound(exchange);
+			return;
 		}
+		List<String> strlist = new ArrayList<>();
+		strlist.add("image/png");
+		exchange.getResponseHeaders().put("content-type", strlist);
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		ImageIO.write(image, "png", baos);
+		baos.flush();
+		byte[] imageInByte = baos.toByteArray();
+		baos.close();
+		Helper.sendResponseOk(imageInByte, exchange);
 	}
 
 	private BufferedImage getLocalImage(String uri) {
diff --git a/WebServer/src/code/ObtainToken.java b/WebServer/src/code/ObtainToken.java
index a22b4c1ecd939d6e408e746b4a88cacaa9cf3b59..6b0d0976f673e424e769e00ff70e1e3dc13219a7 100644
--- a/WebServer/src/code/ObtainToken.java
+++ b/WebServer/src/code/ObtainToken.java
@@ -1,29 +1,13 @@
 package code;
 
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
 import java.net.URI;
-import java.net.URL;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
 import java.util.ArrayList;
-
 import java.util.List;
 
-import javax.net.ssl.HttpsURLConnection;
-
-import org.apache.commons.codec.binary.Base64;
-
 import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpsExchange;
 import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpsExchange;
 
 public class ObtainToken implements HttpHandler{
 
@@ -38,45 +22,38 @@ public class ObtainToken implements HttpHandler{
         HttpsExchange exchange = (HttpsExchange) ex;
         URI requestURI = exchange.getRequestURI();
         String stringURI = requestURI.toString();
-        boolean wantsRedirectPage = Helper.compareText(stringURI,URI.create("/").toString());
-        boolean wantsToken = Helper.compareText(stringURI,URI.create("/secured").toString());
+        boolean wantsRedirectPage = Helper.isSameString(stringURI,URI.create("/").toString());
+        boolean wantsToken = Helper.isSameString(stringURI,URI.create("/secured").toString());
 
         if(!wantsRedirectPage && !wantsToken) {
-            String error = "Invalid URI";
-            OutputStream os = exchange.getResponseBody();
-            exchange.sendResponseHeaders(400, error.getBytes().length);
-            os.write(error.getBytes());
-            os.close();
+            Helper.pageNotFound(exchange);
             return;
         }
 
         String requestMethod = exchange.getRequestMethod();
-        if (Helper.compareText(requestMethod, "GET")) {
-					// get the html page
-		            List<String> strlist = new ArrayList<>();
-		            String response = null;
-		            if(wantsRedirectPage)
-		            	response = getRedirectPage("/redirect.html");
-		            if(wantsToken)
-		            	response = getRedirectPage("/domains.html");
-		            strlist.add("text/html");
-
-		            if(response != null && !Helper.compareText(response, "fail")){
-		            	response = response.replace("$DOMAIN", kcs.authServer())
-		            			.replace("$REALM", kcs.realm())
-		            			.replace("$MY_REDIRECT_URI", kcs.redirectUri());
-
-		                exchange.getResponseHeaders().put("content-type", strlist);
-		                exchange.sendResponseHeaders(200, response.getBytes().length);
-		                OutputStream os = exchange.getResponseBody();
-		                os.write(response.getBytes());
-		                os.close();
-		            } else {
-		                exchange.sendResponseHeaders(500, response.getBytes().length);
-		                OutputStream os = exchange.getResponseBody();
-		                os.write(response.getBytes());
-		                os.close();
-		            }
+        if (!Helper.isSameString(requestMethod, "GET")) {
+            Helper.methodNotAllowed(exchange);
+            return;
+        }
+        // get the html page
+        String response = null;
+        if(wantsRedirectPage)
+        response = Helper.getPageContents("redirect.html");
+        else if(wantsToken)
+        response = Helper.getPageContents("domains.html");
+
+        if(response == null || Helper.isSameString(response, "fail")){
+            Helper.serverError(exchange);
+            return;
+        }
+        response = response.replace("$DOMAIN", kcs.authServer())
+        .replace("$REALM", kcs.realm())
+        .replace("$MY_REDIRECT_URI", kcs.redirectUri());
+
+        List<String> strlist = new ArrayList<>();
+        strlist.add("text/html");
+        exchange.getResponseHeaders().put("content-type", strlist);
+        Helper.sendResponseOk(response, exchange);
 
 //        	if(wantsToken) {
         		// NON FUNZIONA PERCHE' LA
@@ -133,72 +110,14 @@ public class ObtainToken implements HttpHandler{
 //        	String answer = response.replace(remoteHOST,localHOST);
 
 //        	}
-        } else {
-            Helper.methodNotAllowed(exchange);
-        }
     }
 
 
 
-	private static String getRedirectPage(String fileName) {
-        String line;
-        String page = Server.CLIENT_PATH+fileName;
-
-        StringBuilder answer = new StringBuilder();
-        if (getExtension(page).length() == 0)
-            page += ".html";
-
-        BufferedReader bufferedReader = null;
-        try {
-            FileReader fileReader = new FileReader(page);
-
-            bufferedReader = new BufferedReader(fileReader);
-            boolean isComment = false;
-            while ((line = bufferedReader.readLine()) != null) {
-            	line = line.trim();
-
-            	if(line.startsWith("<!--") && line.endsWith("-->")) {
-            		continue;
-            	}
-            	if(line.startsWith("<!--")) {
-            		isComment = true;
-            		continue;
-            	}
-            	if(line.endsWith("-->")) {
-            		isComment = false;
-            		continue;
-            	}
-
-            	if(!isComment && line.length()>0)
-                	answer.append(line).append("\n");
-            }
-        } catch (FileNotFoundException ex) {
-            System.out.println("Unable to open file '" + page + "'");
-            return "fail";
-        } catch (IOException ex) {
-            System.out.println("Error reading file '" + page + "'");
-            return "fail";
-        } finally {
-            try{
-                if(bufferedReader != null)
-                    bufferedReader.close();
-            } catch (IOException ex){
-                System.out.println("Error closing bufferedReader");
-            }
-        }
-        return answer.toString();
-    }
 
 
-    private static String getExtension(String file) {
-        int i = file.length() - 1;
-        while (i > 0 && file.charAt(i) != '.' && file.charAt(i) != '/')
-            i--;
-        if (file.charAt(i) == '.')
-            return file.substring(i + 1);
-        else
-            return "";
-    }
+
+
 
 //
 //    private String createRandomString() {
diff --git a/WebServer/src/code/Resources.java b/WebServer/src/code/Resources.java
index c2029e38a34e4be0c46558b757c91813a8574739..016b08073cec16d84377bf381b4213705e66b012 100644
--- a/WebServer/src/code/Resources.java
+++ b/WebServer/src/code/Resources.java
@@ -22,7 +22,7 @@ public class Resources implements HttpHandler {
 		String requestURI = exchange.getRequestURI().toASCIIString().replace("/secured/home/","/");
 
         String requestMethod = exchange.getRequestMethod();
-        if (Helper.compareText(requestMethod, "GET")) {
+        if (Helper.isSameString(requestMethod, "GET")) {
             String response = getLocalPage(requestURI);
             if(response.equals("fail")){
                 //nel caso in cui non ci sia il file (perche non stato scaricato), allora creo un file fittizzio per non far crashare tutto il resto
diff --git a/WebServer/src/code/Server.java b/WebServer/src/code/Server.java
index 651a807871efbd2a9502417c6b2e601baf4ff760..9a8d59b5026632be63d200739fa72f907d025fe0 100644
--- a/WebServer/src/code/Server.java
+++ b/WebServer/src/code/Server.java
@@ -1,8 +1,10 @@
 package code;
 
 import java.io.FileInputStream;
-import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.security.KeyStore;
+import java.util.concurrent.Executors;
 
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;
@@ -13,32 +15,23 @@ import javax.net.ssl.TrustManagerFactory;
 import com.sun.net.httpserver.HttpsConfigurator;
 import com.sun.net.httpserver.HttpsParameters;
 import com.sun.net.httpserver.HttpsServer;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.security.KeyStore;
-import java.util.concurrent.Executors;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLParameters;
-import javax.net.ssl.TrustManagerFactory;
 
 public class Server {
 
 //    private static int port = 443;
-    private static int port = 3000;
-	public final static String CLIENT_PATH = "./../../webapp/public";
+    // private static int port = 3000;
+	public final static String CLIENT_PATH = "../public";
 
     public static void main(String[] args) throws IOException {
-        if (args.length > 1 && args[0].equals("-port"))
+        /*if (args.length > 1 && args[0].equals("-port"))
             try {
                 port = Integer.parseInt(args[1]);
             } catch (Exception e) {
                 e.printStackTrace();
-            }
+            }*/
         KeyCloak kcs = new KeyCloak(CLIENT_PATH + "/keycloak.json", CLIENT_PATH + "/params.json");
-        HttpsServer server = HttpsServer.create(new InetSocketAddress(port), 0);
+        int port = 3000;
+        HttpsServer server = HttpsServer.create(new InetSocketAddress(port), 0);//port gets set here
         // HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
 
         // initialise the HTTPS server
diff --git a/antifurto/bin/code/SubscribeCallback.class b/antifurto/bin/code/SubscribeCallback.class
index 9e7e7ad2166edd8170626d1b67594375f7cf196d..2d35aaaa9b9d777cda775ec555b8757af8b06e07 100644
Binary files a/antifurto/bin/code/SubscribeCallback.class and b/antifurto/bin/code/SubscribeCallback.class differ
diff --git a/domainManager/Domain/bin/code/DeleteHandler.class b/domainManager/Domain/bin/code/DeleteHandler.class
index 6e3d62164834c094b4f1c82658e2c41d27bd5236..0dd90e2686f440a857af2a509f6c9ba0234802d8 100644
Binary files a/domainManager/Domain/bin/code/DeleteHandler.class and b/domainManager/Domain/bin/code/DeleteHandler.class differ
diff --git a/domainManager/Domain/bin/code/Domain.class b/domainManager/Domain/bin/code/Domain.class
index 4eaaa810bd027dd436456bb3b41b6ae53c2b05e5..562e1ec451c47c50594506a54f6d68ba8cbaeffa 100644
Binary files a/domainManager/Domain/bin/code/Domain.class and b/domainManager/Domain/bin/code/Domain.class differ
diff --git a/domainManager/Domain/bin/code/Helper.class b/domainManager/Domain/bin/code/Helper.class
index b760e60058e082a379063c67cc5ebeba2914bd45..46540e3d67e5e65421b6127e28359c2ac99e119c 100644
Binary files a/domainManager/Domain/bin/code/Helper.class and b/domainManager/Domain/bin/code/Helper.class differ
diff --git a/domainManager/Domain/bin/code/InstallHandler.class b/domainManager/Domain/bin/code/InstallHandler.class
index 7d419ee23fccca0ce55ad7a04b3e34741c423673..362d0ab92405a8e4bf54550f3ff2196b0157237d 100644
Binary files a/domainManager/Domain/bin/code/InstallHandler.class and b/domainManager/Domain/bin/code/InstallHandler.class differ
diff --git a/domainManager/Domain/bin/code/PriviledgesHandler.class b/domainManager/Domain/bin/code/PriviledgesHandler.class
index fbbf9e14f5bfeb3fdfdb593dc81ba637f67f0e3b..c8289ab2d59f7f2b1ea2b06b30d53620333d3765 100644
Binary files a/domainManager/Domain/bin/code/PriviledgesHandler.class and b/domainManager/Domain/bin/code/PriviledgesHandler.class differ
diff --git a/domainManager/Domain/bin/code/ServicesHandler.class b/domainManager/Domain/bin/code/ServicesHandler.class
index e2272c0dc4eec585dd87c5711b7d282d8e28c8c6..9359e456161d6d383c093f0628b1521f90e8864b 100644
Binary files a/domainManager/Domain/bin/code/ServicesHandler.class and b/domainManager/Domain/bin/code/ServicesHandler.class differ
diff --git a/domainManager/Domain/bin/code/StartHandler.class b/domainManager/Domain/bin/code/StartHandler.class
index 8b8f30ad200657d363580ec938022d219a85a9ea..f3d977cb61865363d16759f6dff3c00320ca35cc 100644
Binary files a/domainManager/Domain/bin/code/StartHandler.class and b/domainManager/Domain/bin/code/StartHandler.class differ
diff --git a/domainManager/Domain/bin/code/StopHandler.class b/domainManager/Domain/bin/code/StopHandler.class
index 540eb8102388d19bc07bccb7f71471e420e78db5..8351a5751d9822951b145032539933e8e5cc1bcc 100644
Binary files a/domainManager/Domain/bin/code/StopHandler.class and b/domainManager/Domain/bin/code/StopHandler.class differ
diff --git a/domainManager/Domain/bin/code/TokenHandler.class b/domainManager/Domain/bin/code/TokenHandler.class
index 718e2795a9e48b79ab61d1d3b1b4b946e71532f7..fa4439d5c6d8d68152dc33388dcc0e31d2eb33c1 100644
Binary files a/domainManager/Domain/bin/code/TokenHandler.class and b/domainManager/Domain/bin/code/TokenHandler.class differ
diff --git a/domainManager/Domain/bin/db/DBC.class b/domainManager/Domain/bin/db/DBC.class
index 1ca59c91ec55cd7a1f421831f492869fb3195d70..b85887cf5868415af7029bff73b88112a0242292 100644
Binary files a/domainManager/Domain/bin/db/DBC.class and b/domainManager/Domain/bin/db/DBC.class differ
diff --git a/keycloak-19.0.1/data/h2/keycloakdb.trace.db b/keycloak-19.0.1/data/h2/keycloakdb.trace.db
index 9926b8be8da8f6094c0e788a06cf74bcd239ef85..7917fcf2dd378da91d387e3d723f97a55ae35b67 100644
--- a/keycloak-19.0.1/data/h2/keycloakdb.trace.db
+++ b/keycloak-19.0.1/data/h2/keycloakdb.trace.db
@@ -1810,3 +1810,34 @@ org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic c
 	at io.quarkus.runtime.Application.stop(Application.java:203)
 	at io.quarkus.runtime.Application.stop(Application.java:155)
 	at io.quarkus.runtime.ApplicationLifecycleManager$ShutdownHookThread.run(ApplicationLifecycleManager.java:420)
+2022-09-17 10:59:21 jdbc[3]: exception
+org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-197]
+	at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
+	at org.h2.message.DbException.get(DbException.java:179)
+	at org.h2.message.DbException.get(DbException.java:155)
+	at org.h2.message.DbException.get(DbException.java:144)
+	at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1526)
+	at org.h2.jdbcx.JdbcXAConnection$PooledJdbcConnection.checkClosed(JdbcXAConnection.java:470)
+	at org.h2.jdbc.JdbcConnection.checkClosedForWrite(JdbcConnection.java:1512)
+	at org.h2.jdbc.JdbcConnection.rollback(JdbcConnection.java:516)
+	at org.h2.jdbcx.JdbcXAConnection$PooledJdbcConnection.close(JdbcXAConnection.java:450)
+	at org.h2.jdbcx.JdbcXAConnection.close(JdbcXAConnection.java:78)
+	at io.agroal.pool.ConnectionHandler.closeConnection(ConnectionHandler.java:185)
+	at io.agroal.pool.ConnectionPool$DestroyConnectionTask.run(ConnectionPool.java:768)
+	at io.agroal.pool.ConnectionPool.close(ConnectionPool.java:189)
+	at io.agroal.pool.DataSource.close(DataSource.java:79)
+	at io.quarkus.agroal.runtime.DataSources.stop(DataSources.java:381)
+	at io.quarkus.agroal.runtime.DataSources_Bean.destroy(Unknown Source)
+	at io.quarkus.agroal.runtime.DataSources_Bean.destroy(Unknown Source)
+	at io.quarkus.arc.impl.AbstractInstanceHandle.destroyInternal(AbstractInstanceHandle.java:80)
+	at io.quarkus.arc.impl.ContextInstanceHandleImpl.destroy(ContextInstanceHandleImpl.java:20)
+	at io.quarkus.arc.impl.AbstractSharedContext.destroy(AbstractSharedContext.java:94)
+	at io.quarkus.arc.impl.ArcContainerImpl.shutdown(ArcContainerImpl.java:369)
+	at io.quarkus.arc.Arc.shutdown(Arc.java:52)
+	at io.quarkus.arc.runtime.ArcRecorder$1.run(ArcRecorder.java:44)
+	at io.quarkus.runtime.StartupContext.runAllInReverseOrder(StartupContext.java:84)
+	at io.quarkus.runtime.StartupContext.close(StartupContext.java:73)
+	at io.quarkus.runner.ApplicationImpl.doStop(Unknown Source)
+	at io.quarkus.runtime.Application.stop(Application.java:203)
+	at io.quarkus.runtime.Application.stop(Application.java:155)
+	at io.quarkus.runtime.ApplicationLifecycleManager$ShutdownHookThread.run(ApplicationLifecycleManager.java:420)