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.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java
index a41ccf9b..baaa1cae 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;
@@ -47,14 +47,17 @@ public class Main extends HttpServlet implements XmppListener {
User pagesUser = new User();
UserThread pagesUserThread = new UserThread();
NewMessage pagesNewMessage = new NewMessage();
-
+ FacebookLogin loginFacebook = new FacebookLogin();
+ 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=");
@@ -63,15 +66,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();
@@ -92,17 +95,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);
@@ -121,7 +124,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")) {
@@ -140,7 +143,11 @@ public class Main extends HttpServlet implements XmppListener {
} else if (uri.equals("/logout")) {
login.doGetLogout(sql, request, response);
} else if (uri.equals("/settings")) {
- //TODO settings
+ settings.doGet(sql, request, response);
+ } else if (uri.equals("/_fblogin")) {
+ loginFacebook.doGet(sql, request, response);
+ } else if (uri.equals("/signup")) {
+ signup.doGet(sql, request, response);
} else if (uri.equals("/help") || uri.equals("/help/")) {
help.doRedirectToHelpIndex(sql, request, response);
} else if (uri.startsWith("/help/")) {
@@ -230,7 +237,10 @@ public class Main extends HttpServlet implements XmppListener {
pagesNewMessage.doPostNewMessage(sql, request, response);
} else if (uri.equals("/login")) {
login.doPostLogin(sql, request, response);
+ } else if (uri.equals("/signup")) {
+ signup.doPost(sql, request, response);
} else if (uri.equals("/settings")) {
+ settings.doPost(sql, request, response);
} else {
response.sendError(405);
}