From 0a41b55c0343a1d60f1137fde5912367dec71197 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Mon, 10 Feb 2014 23:23:19 +0700 Subject: redirect /?tag -> /tag/ --- src/java/com/juick/http/www/Main.java | 10 ++++++++-- 1 file 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) { -- cgit v1.2.3