diff options
author | 2014-07-30 16:47:29 +0700 | |
---|---|---|
committer | 2014-07-30 16:47:29 +0700 | |
commit | c4eebb74f520c122800c000c2329d3b6b7520c65 (patch) | |
tree | 99fa7c755ed488c4e566c9a2c14c37e079fdb9ae /src/java/com/juick/http/www/Main.java | |
parent | 6856f7278584425b0cb6fc54d50f5d5cf4a3f88e (diff) |
Reader link tracking
Diffstat (limited to 'src/java/com/juick/http/www/Main.java')
-rw-r--r-- | src/java/com/juick/http/www/Main.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index 1d5e64d3..0fe93173 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -43,7 +43,7 @@ import ru.sape.Sape; @WebServlet(name = "Main", urlPatterns = {"/"}) @MultipartConfig(fileSizeThreshold = 1024 * 1024, maxRequestSize = 1024 * 1024 * 10) public class Main extends HttpServlet implements Stream.StreamListener { - + Connection sql; Connection sqlSearch; Stream xmpp; @@ -60,29 +60,29 @@ public class Main extends HttpServlet implements Stream.StreamListener { VKontakteLogin loginVK = new VKontakteLogin(); SignUp signup = new SignUp(); Settings settings = new Settings(); - + @Override public void init() throws ServletException { super.init(); try { Properties conf = new Properties(); conf.load(new FileInputStream("/etc/juick/www.conf")); - + Class.forName("com.mysql.jdbc.Driver"); sql = DriverManager.getConnection("jdbc:mysql://localhost/juick?autoReconnect=true&user=" + conf.getProperty("mysql_username", "") + "&password=" + conf.getProperty("mysql_password", "")); sqlSearch = DriverManager.getConnection("jdbc:mysql://127.0.0.1:9306?autoReconnect=true&characterEncoding=utf8&maxAllowedPacket=512000", "", ""); - + setupXmppComponent(conf.getProperty("xmpp_password")); - + PageTemplates.sape = new Sape(conf.getProperty("sape_user"), "juick.com", 2000, 3600); } catch (Exception e) { log(null, e); } } - + public void setupXmppComponent(final String password) { Thread thr = new Thread(new Runnable() { - + @Override public void run() { try { @@ -97,17 +97,17 @@ public class Main extends HttpServlet implements Stream.StreamListener { }); thr.start(); } - + @Override public void onStreamFail(String msg) { System.err.println("XMPP STREAM FAIL: " + msg); } - + @Override public void onStreamReady() { System.err.println("XMPP STREAM READY"); } - + @Override public void destroy() { super.destroy(); @@ -142,7 +142,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { request.setCharacterEncoding("UTF-8"); } String uri = request.getRequestURI(); - + if (uri.equals("/")) { String tag = request.getParameter("tag"); if (tag != null) { @@ -153,6 +153,8 @@ public class Main extends HttpServlet implements Stream.StreamListener { } } else if (uri.equals("/reader")) { reader.doGet(sql, request, response); + } else if (uri.equals("/_out")) { + reader.doGetOut(sql, request, response); } else if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); if (visitor != null) { @@ -272,7 +274,7 @@ public class Main extends HttpServlet implements Stream.StreamListener { if (request.getCharacterEncoding() == null) { request.setCharacterEncoding("UTF-8"); } - + String uri = request.getRequestURI(); if (uri.equals("/post")) { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); |