diff --git a/src/main/java/de/hsel/itech/config/Configuration.java b/src/main/java/de/hsel/itech/config/Configuration.java index 2f6f02e..3c2b440 100644 --- a/src/main/java/de/hsel/itech/config/Configuration.java +++ b/src/main/java/de/hsel/itech/config/Configuration.java @@ -15,20 +15,23 @@ import java.io.FileReader; * @since 0.1 */ -@Getter @ToString @EqualsAndHashCode public class Configuration { + private static final String filename = "config.json"; + + @Getter private Database database; - public static Configuration get(String fileName) { + + public static Configuration get() { Gson gson = new Gson(); FileReader reader = null; try { - reader = new FileReader(new File(fileName)); + reader = new FileReader(new File(filename)); } catch (FileNotFoundException e) { e.printStackTrace(); } diff --git a/src/main/java/de/hsel/itech/db/Database.java b/src/main/java/de/hsel/itech/db/Database.java index 175c1a0..f624cb6 100644 --- a/src/main/java/de/hsel/itech/db/Database.java +++ b/src/main/java/de/hsel/itech/db/Database.java @@ -20,7 +20,7 @@ public class Database { @Nullable private Connection getConnection() { - Configuration config = Configuration.get("config.json"); + Configuration config = Configuration.get(); try { return DriverManager.getConnection("jdbc:mariadb://" + config.getDatabase().getHostname() + ":" + config.getDatabase().getPort() + "/" + config.getDatabase().getDatabase(), config.getDatabase().getUsername(), config.getDatabase().getPassword()); diff --git a/src/main/java/de/hsel/itech/servlet/HelloWorld.java b/src/main/java/de/hsel/itech/servlet/HelloWorld.java index b22757d..9aa5a44 100644 --- a/src/main/java/de/hsel/itech/servlet/HelloWorld.java +++ b/src/main/java/de/hsel/itech/servlet/HelloWorld.java @@ -3,6 +3,7 @@ package de.hsel.itech.servlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.IOException; import java.io.PrintWriter; @@ -30,12 +31,15 @@ public class HelloWorld extends HttpServlet { resp.setContentType("text/html"); final PrintWriter out = resp.getWriter(); + out.println(""); out.println(""); out.println("
"); out.println("