diff options
author | Ugnich Anton | 2014-02-10 23:23:19 +0700 |
---|---|---|
committer | Ugnich Anton | 2014-02-10 23:23:19 +0700 |
commit | 0a41b55c0343a1d60f1137fde5912367dec71197 (patch) | |
tree | cee2e363e33106394138fff16648ead0e5c4aac5 /src/java/com/juick | |
parent | 8b6824e9b54ad54ffd6df9baecc67cdb33027f78 (diff) |
redirect /?tag -> /tag/
Diffstat (limited to 'src/java/com/juick')
-rw-r--r-- | src/java/com/juick/http/www/Main.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index 2417e6c8..66237ebe 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -23,6 +23,7 @@ import com.juick.xmpp.StreamComponent; import java.io.FileInputStream; import java.io.IOException; import java.net.Socket; +import java.net.URLEncoder; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @@ -142,8 +143,13 @@ public class Main extends HttpServlet implements Stream.StreamListener { String uri = request.getRequestURI(); if (uri.equals("/")) { - com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - home.doGet(sql, sqlSearch, request, response, visitor); + String tag = request.getParameter("tag"); + if (tag != null) { + Utils.sendPermanentRedirect(response, "/tag/" + URLEncoder.encode(tag, "UTF-8")); + } else { + com.juick.User visitor = Utils.getVisitorUser(sql, request, response); + home.doGet(sql, sqlSearch, request, response, visitor); + } } else if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); if (visitor != null) { |