diff options
author | 2015-11-03 16:08:42 +0300 | |
---|---|---|
committer | 2015-11-03 16:08:42 +0300 | |
commit | a1224e0db03b6116e4f7f2ed7f8ce265c41ca230 (patch) | |
tree | 6763d6de099794fa7237b3f64b103b637ec757ec /src/main/java | |
parent | 7bb57710ce22b5c6d7efd1fdf58150e6fa961a90 (diff) |
try to use uid from url
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/http/www/Main.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/com/juick/http/www/Main.java b/src/main/java/com/juick/http/www/Main.java index ced7fb98..4c7f7e14 100644 --- a/src/main/java/com/juick/http/www/Main.java +++ b/src/main/java/com/juick/http/www/Main.java @@ -228,16 +228,21 @@ public class Main extends HttpServlet implements Stream.StreamListener { closeSqlSearch(); } else if (uri.matches("^/\\d+$")) { String strID = request.getRequestURI().substring(1); - int mid = 0; + int uid = 0; try { - mid = Integer.parseInt(strID); + uid = Integer.parseInt(strID); } catch (NumberFormatException e) { } - if (mid > 0) { - com.juick.User author = com.juick.server.MessagesQueries.getMessageAuthor(sql, mid); + if (uid > 0) { + com.juick.User author = UserQueries.getUserByUID(sql, uid); if (author != null) { - Utils.sendPermanentRedirect(response, "/" + author.UName + "/" + mid); - return; + if (author.UName != null) { + Utils.sendPermanentRedirect(response, "/" + author.UName); + return; + } else { + pagesUser.doGetBlog(sql, getSqlSearch(), request, response, author); + return; + } } } Errors.doGet404(sql, request, response); |