From 2fdd37385c64a39eb7d131dd5d96f9b9f645f6a8 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 4 Aug 2016 13:19:25 +0200 Subject: [PATCH] Moved IOHelper --- .../norbipeti/chat/server/io/IOHelper.java | 2 +- .../norbipeti/chat/server/page/IndexPage.java | 3 +- .../chat/server/page/LoginAjaxPage.java | 2 +- .../chat/server/page/LogoutPage.java | 2 +- .../chat/server/page/NotFoundPage.java | 56 +++++++++---------- .../norbipeti/chat/server/page/Page.java | 2 +- .../chat/server/page/RegisterAjaxPage.java | 2 +- .../chat/server/page/ScriptsPage.java | 2 +- .../chat/server/page/SendMessageAjaxPage.java | 2 +- .../norbipeti/chat/server/page/StylePage.java | 2 +- 10 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/io/github/norbipeti/chat/server/io/IOHelper.java b/src/io/github/norbipeti/chat/server/io/IOHelper.java index dcf5d87..12f45c3 100644 --- a/src/io/github/norbipeti/chat/server/io/IOHelper.java +++ b/src/io/github/norbipeti/chat/server/io/IOHelper.java @@ -1,4 +1,4 @@ -package io.github.norbipeti.chat.server; +package io.github.norbipeti.chat.server.io; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; diff --git a/src/io/github/norbipeti/chat/server/page/IndexPage.java b/src/io/github/norbipeti/chat/server/page/IndexPage.java index 837b635..fc97c7c 100644 --- a/src/io/github/norbipeti/chat/server/page/IndexPage.java +++ b/src/io/github/norbipeti/chat/server/page/IndexPage.java @@ -7,12 +7,13 @@ import org.apache.logging.log4j.LogManager; import org.jsoup.nodes.Element; import com.sun.net.httpserver.HttpExchange; -import io.github.norbipeti.chat.server.IOHelper; + import io.github.norbipeti.chat.server.data.DataManager; import io.github.norbipeti.chat.server.db.domain.Conversation; import io.github.norbipeti.chat.server.db.domain.Message; import io.github.norbipeti.chat.server.db.domain.MessageChunk; import io.github.norbipeti.chat.server.db.domain.User; +import io.github.norbipeti.chat.server.io.IOHelper; public class IndexPage extends Page { diff --git a/src/io/github/norbipeti/chat/server/page/LoginAjaxPage.java b/src/io/github/norbipeti/chat/server/page/LoginAjaxPage.java index 1762761..3f656cc 100644 --- a/src/io/github/norbipeti/chat/server/page/LoginAjaxPage.java +++ b/src/io/github/norbipeti/chat/server/page/LoginAjaxPage.java @@ -6,9 +6,9 @@ import org.mindrot.jbcrypt.BCrypt; import com.google.gson.JsonObject; import com.sun.net.httpserver.HttpExchange; -import io.github.norbipeti.chat.server.IOHelper; import io.github.norbipeti.chat.server.data.DataManager; import io.github.norbipeti.chat.server.db.domain.User; +import io.github.norbipeti.chat.server.io.IOHelper; public class LoginAjaxPage extends Page { diff --git a/src/io/github/norbipeti/chat/server/page/LogoutPage.java b/src/io/github/norbipeti/chat/server/page/LogoutPage.java index c5e5f96..8ced648 100644 --- a/src/io/github/norbipeti/chat/server/page/LogoutPage.java +++ b/src/io/github/norbipeti/chat/server/page/LogoutPage.java @@ -4,8 +4,8 @@ import java.io.IOException; import com.sun.net.httpserver.HttpExchange; -import io.github.norbipeti.chat.server.IOHelper; import io.github.norbipeti.chat.server.db.domain.User; +import io.github.norbipeti.chat.server.io.IOHelper; public class LogoutPage extends Page { diff --git a/src/io/github/norbipeti/chat/server/page/NotFoundPage.java b/src/io/github/norbipeti/chat/server/page/NotFoundPage.java index 409aced..7aa33fb 100644 --- a/src/io/github/norbipeti/chat/server/page/NotFoundPage.java +++ b/src/io/github/norbipeti/chat/server/page/NotFoundPage.java @@ -1,28 +1,28 @@ -package io.github.norbipeti.chat.server.page; - -import java.io.IOException; - -import com.sun.net.httpserver.HttpExchange; - -import io.github.norbipeti.chat.server.IOHelper; - -public class NotFoundPage extends Page { - - @Override - public String GetName() { - return "notfound"; - } - - @Override - public void handlePage(HttpExchange exchange) throws IOException { - IOHelper.SendPage(404, this, exchange); - } - - public NotFoundPage() { - if (Instance != null) - throw new UnsupportedOperationException("There can only be one instance of a page."); - Instance = this; - } - - public static NotFoundPage Instance; -} +package io.github.norbipeti.chat.server.page; + +import java.io.IOException; + +import com.sun.net.httpserver.HttpExchange; + +import io.github.norbipeti.chat.server.io.IOHelper; + +public class NotFoundPage extends Page { + + @Override + public String GetName() { + return "notfound"; + } + + @Override + public void handlePage(HttpExchange exchange) throws IOException { + IOHelper.SendPage(404, this, exchange); + } + + public NotFoundPage() { + if (Instance != null) + throw new UnsupportedOperationException("There can only be one instance of a page."); + Instance = this; + } + + public static NotFoundPage Instance; +} diff --git a/src/io/github/norbipeti/chat/server/page/Page.java b/src/io/github/norbipeti/chat/server/page/Page.java index a2489d8..14d7f98 100644 --- a/src/io/github/norbipeti/chat/server/page/Page.java +++ b/src/io/github/norbipeti/chat/server/page/Page.java @@ -8,8 +8,8 @@ import org.apache.commons.io.output.ByteArrayOutputStream; import com.sun.net.httpserver.*; -import io.github.norbipeti.chat.server.IOHelper; import io.github.norbipeti.chat.server.Main; +import io.github.norbipeti.chat.server.io.IOHelper; /** * Add to {@link Main}.Pages diff --git a/src/io/github/norbipeti/chat/server/page/RegisterAjaxPage.java b/src/io/github/norbipeti/chat/server/page/RegisterAjaxPage.java index 3152e9f..e34579c 100644 --- a/src/io/github/norbipeti/chat/server/page/RegisterAjaxPage.java +++ b/src/io/github/norbipeti/chat/server/page/RegisterAjaxPage.java @@ -6,9 +6,9 @@ import org.mindrot.jbcrypt.BCrypt; import com.google.gson.JsonObject; import com.sun.net.httpserver.HttpExchange; -import io.github.norbipeti.chat.server.IOHelper; import io.github.norbipeti.chat.server.data.DataManager; import io.github.norbipeti.chat.server.db.domain.User; +import io.github.norbipeti.chat.server.io.IOHelper; public class RegisterAjaxPage extends Page { @Override diff --git a/src/io/github/norbipeti/chat/server/page/ScriptsPage.java b/src/io/github/norbipeti/chat/server/page/ScriptsPage.java index e23bf39..3d61b4f 100644 --- a/src/io/github/norbipeti/chat/server/page/ScriptsPage.java +++ b/src/io/github/norbipeti/chat/server/page/ScriptsPage.java @@ -8,7 +8,7 @@ import org.apache.logging.log4j.LogManager; import com.sun.net.httpserver.HttpExchange; -import io.github.norbipeti.chat.server.IOHelper; +import io.github.norbipeti.chat.server.io.IOHelper; public class ScriptsPage extends Page { diff --git a/src/io/github/norbipeti/chat/server/page/SendMessageAjaxPage.java b/src/io/github/norbipeti/chat/server/page/SendMessageAjaxPage.java index 7a13f22..ac82126 100644 --- a/src/io/github/norbipeti/chat/server/page/SendMessageAjaxPage.java +++ b/src/io/github/norbipeti/chat/server/page/SendMessageAjaxPage.java @@ -7,13 +7,13 @@ import org.apache.logging.log4j.LogManager; import com.google.gson.JsonObject; import com.sun.net.httpserver.HttpExchange; -import io.github.norbipeti.chat.server.IOHelper; import io.github.norbipeti.chat.server.data.DataManager; import io.github.norbipeti.chat.server.data.LoaderCollection; import io.github.norbipeti.chat.server.db.domain.Conversation; import io.github.norbipeti.chat.server.db.domain.Message; import io.github.norbipeti.chat.server.db.domain.MessageChunk; import io.github.norbipeti.chat.server.db.domain.User; +import io.github.norbipeti.chat.server.io.IOHelper; public class SendMessageAjaxPage extends Page { diff --git a/src/io/github/norbipeti/chat/server/page/StylePage.java b/src/io/github/norbipeti/chat/server/page/StylePage.java index dc821ec..1a953c0 100644 --- a/src/io/github/norbipeti/chat/server/page/StylePage.java +++ b/src/io/github/norbipeti/chat/server/page/StylePage.java @@ -8,7 +8,7 @@ import org.apache.logging.log4j.LogManager; import com.sun.net.httpserver.HttpExchange; -import io.github.norbipeti.chat.server.IOHelper; +import io.github.norbipeti.chat.server.io.IOHelper; public class StylePage extends Page {