aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/Errors.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/juick/http/www/Errors.java')
-rw-r--r--src/java/com/juick/http/www/Errors.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/java/com/juick/http/www/Errors.java b/src/java/com/juick/http/www/Errors.java
new file mode 100644
index 00000000..c1ffc2e8
--- /dev/null
+++ b/src/java/com/juick/http/www/Errors.java
@@ -0,0 +1,47 @@
+package com.juick.http.www;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author ugnich
+ */
+public class Errors {
+
+ public static String tagsHTML = null;
+
+ public static void doGet404(Connection sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ com.juick.User visitor = Utils.getVisitorUser(sql, request, response);
+
+ if (tagsHTML == null) {
+ tagsHTML = PageTemplates.getPopularTags(sql, 80);
+ }
+
+ response.setStatus(404);
+ response.setContentType("text/html; charset=UTF-8");
+ PrintWriter out = response.getWriter();
+ try {
+ PageTemplates.pageHead(out, "404 Страница не найдена", null);
+ PageTemplates.pageNavigation(out, visitor, null);
+
+ out.println("<aside id=\"column\">");
+ out.println(" <p class=\"tags\">" + tagsHTML + "</p>");
+ out.println("</aside>");
+
+ out.println("<section id=\"content\">");
+ out.println("<h1>Страница не найдена</h1>");
+ out.println("<p>Сожалеем, но страницу с этим адресом удалил её автор, либо её никогда не существовало.</p>");
+ out.println("</section>");
+
+ PageTemplates.pageFooter(request, out, visitor, false);
+ PageTemplates.pageEnd(out);
+ } finally {
+ out.close();
+ }
+ }
+}