annotate src/jungle/test/bbs/App.java @ 38:d8ee57a1c2c6

add pom.xml and bbs
author one
date Mon, 08 Jul 2013 20:25:58 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
1 package jungle.test.bbs;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
2
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
3 import javax.servlet.Servlet;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
4
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
5 import org.mortbay.jetty.Server;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
6 import org.mortbay.jetty.servlet.ServletHandler;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
7 import org.mortbay.jetty.servlet.ServletHolder;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
8
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
9 /**
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
10 * Hello world!
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
11 *
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
12 */
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
13 public class App
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
14 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
15 public static void main( String[] args ) throws Exception
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
16 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
17 BulletinBoard cassaBBS = null;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
18 if(args.length == 0){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
19 cassaBBS = new JungleBulletinBoard();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
20 }else{
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
21 cassaBBS = new CassandraBulletinBoard("test-cluster","localhost:9160","cassaBBS2");
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
22 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
23
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
24
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
25 String createBoardMessagePath = "/createBoardMessage";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
26 String createBoardPath = "/createBoard";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
27 String editMessagePath = "/editMessage";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
28 String showBoardMessagePath = "/showBoardMessage";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
29
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
30 Servlet createBoardMessage = new CreateBoardMessageServlet(cassaBBS);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
31 Servlet createBoard = new CreateBoardServlet(cassaBBS);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
32 Servlet editBoardMessage = new EditMessageServlet(cassaBBS);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
33 Servlet index = new ShowBoardsServlet(cassaBBS,createBoardPath,showBoardMessagePath);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
34 Servlet board = new ShowBoardMessageServlet(cassaBBS,createBoardMessagePath,editMessagePath);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
35
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
36 Server serv = new Server(8080);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
37 ServletHandler context = new ServletHandler();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
38 context.addServletWithMapping(new ServletHolder(createBoardMessage),createBoardMessagePath);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
39 context.addServletWithMapping(new ServletHolder(createBoard),createBoardPath);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
40 context.addServletWithMapping(new ServletHolder(editBoardMessage),editMessagePath);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
41 context.addServletWithMapping(new ServletHolder(index),"/");
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
42 context.addServletWithMapping(new ServletHolder(board),showBoardMessagePath);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
43 serv.addHandler(context);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
44 serv.start();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
45 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
46 }