diff options
author | 2013-10-21 04:23:40 +0700 | |
---|---|---|
committer | 2013-10-21 04:23:40 +0700 | |
commit | f723832791490ad342c7ab1190d1f16dce84ade9 (patch) | |
tree | 4b22d832c7cd2a96e5fd4ff5986821aabeab29eb /src/java/com/juick/http/www/Main.java | |
parent | 97865f84b09e7a3aaa2f49dcb4f11a08f6b8cbf0 (diff) |
New main page
Diffstat (limited to 'src/java/com/juick/http/www/Main.java')
-rw-r--r-- | src/java/com/juick/http/www/Main.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index 07796fda..4c6e310b 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -110,17 +110,26 @@ public class Main extends HttpServlet { String uri = request.getRequestURI(); if (uri.equals("/")) { - blogs.doGet(sql, sqlSearch, request, response); + com.juick.User visitor = Utils.getVisitorUser(sql, request); + if (request.getQueryString() == null) { + if (visitor == null) { + login.doGetLoginForm(sql, request, response); + } else { + blogs.doGet(sql, sqlSearch, request, response, visitor); + } + } else { + blogs.doGet(sql, sqlSearch, request, response, visitor); + } } else if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request); if (visitor != null) { pagesNewMessage.doGetNewMessage(sql, request, response, visitor); } else { - login.doGetLoginForm(sql, request, response); + Utils.sendTemporaryRedirect(response, "/"); } } else if (uri.equals("/login")) { if (request.getQueryString() == null) { - login.doGetLoginForm(sql, request, response); + Utils.sendPermanentRedirect(response, "/"); } else { login.doGetLogin(sql, request, response); } @@ -139,9 +148,11 @@ public class Main extends HttpServlet { } else if (uri.startsWith("/help/")) { help.doGetHelp(sql, request, response); } else if (uri.startsWith("/tag/")) { - blogs.doGet(sql, sqlSearch, request, response); + com.juick.User visitor = Utils.getVisitorUser(sql, request); + blogs.doGet(sql, sqlSearch, request, response, visitor); } else if (uri.startsWith("/places/")) { - blogs.doGet(sql, sqlSearch, request, response); + com.juick.User visitor = Utils.getVisitorUser(sql, request); + blogs.doGet(sql, sqlSearch, request, response, visitor); } else if (uri.matches("^/\\d+$")) { String strID = request.getRequestURI().substring(1); int mid = 0; |