aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/juick/http/www/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/juick/http/www/Main.java')
-rw-r--r--src/java/com/juick/http/www/Main.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java
index baaa1cae..c84a2f8c 100644
--- a/src/java/com/juick/http/www/Main.java
+++ b/src/java/com/juick/http/www/Main.java
@@ -37,7 +37,7 @@ import ru.sape.Sape;
*/
@WebServlet(name = "Main", urlPatterns = {"/"})
public class Main extends HttpServlet implements XmppListener {
-
+
Connection sql;
Connection sqlSearch;
XmppConnection xmpp;
@@ -48,16 +48,17 @@ public class Main extends HttpServlet implements XmppListener {
UserThread pagesUserThread = new UserThread();
NewMessage pagesNewMessage = new NewMessage();
FacebookLogin loginFacebook = new FacebookLogin();
+ 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/juick?autoReconnect=true&characterEncoding=utf8&maxAllowedPacket=512000&relaxAutoCommit=true&user=root&password=");
@@ -66,15 +67,15 @@ public class Main extends HttpServlet implements XmppListener {
xmpp.addListener((XmppListener) this);
xmpp.start();
*/
-
+
blogs = new Blogs(sql);
-
+
PageTemplates.sape = new Sape(conf.getProperty("sape_user"), "juick.com", 2000, 3600);
} catch (Exception e) {
log(null, e);
}
}
-
+
@Override
public void destroy() {
super.destroy();
@@ -95,17 +96,17 @@ public class Main extends HttpServlet implements XmppListener {
}
}
}
-
+
@Override
public void onAuth(String resource) {
log("XMPP AUTH: " + resource);
}
-
+
@Override
public void onAuthFailed(String message) {
log("XMPP AUTH FAILED: " + message);
}
-
+
@Override
public void onConnectionFailed(String message) {
log("XMPP CONNECTION FAILED: " + message);
@@ -124,7 +125,7 @@ public class Main extends HttpServlet implements XmppListener {
request.setCharacterEncoding("UTF-8");
}
String uri = request.getRequestURI();
-
+
if (uri.equals("/")) {
blogs.doGet(sql, sqlSearch, request, response);
} else if (uri.equals("/post")) {
@@ -146,6 +147,8 @@ public class Main extends HttpServlet implements XmppListener {
settings.doGet(sql, request, response);
} else if (uri.equals("/_fblogin")) {
loginFacebook.doGet(sql, request, response);
+ } else if (uri.equals("/_vklogin")) {
+ loginVK.doGet(sql, request, response);
} else if (uri.equals("/signup")) {
signup.doGet(sql, request, response);
} else if (uri.equals("/help") || uri.equals("/help/")) {