annotate src/main/java/jungle/app/bbs/CreateBoardMessageServlet.java @ 105:f9e29a52efd3

Move some files
author one
date Tue, 26 Nov 2013 06:43:10 +0900
parents src/jungle/app/bbs/CreateBoardMessageServlet.java@29127ac788a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
29127ac788a6 move some files
one
parents: 38
diff changeset
1 package jungle.app.bbs;
38
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
2
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
3 import java.io.PrintWriter;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
4
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
5 import javax.servlet.http.HttpServlet;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
6 import javax.servlet.http.HttpServletRequest;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
7 import javax.servlet.http.HttpServletResponse;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
8
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
9 public class CreateBoardMessageServlet extends HttpServlet
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
10 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
11 private final BulletinBoard bbs;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
12 private static final String PARAM_BOARD_NAME = "bname";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
13 private static final String PARAM_BOARD_AUTHOR = "author";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
14 private static final String PARAM_BOARD_MESSAGE= "msg";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
15 private static final String PARAM_BOARD_EDITKEY = "key";
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
16
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
17 private static final long serialVersionUID = 1L;
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
18
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
19 public CreateBoardMessageServlet(BulletinBoard _bbs)
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
20 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
21 bbs = _bbs;
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 @Override
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
25 public void doPost(HttpServletRequest _req,HttpServletResponse _res)
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
26 {
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
27 String boardName = _req.getParameter(PARAM_BOARD_NAME);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
28 String author = _req.getParameter(PARAM_BOARD_AUTHOR);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
29 String msg = _req.getParameter(PARAM_BOARD_MESSAGE);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
30 String key = _req.getParameter(PARAM_BOARD_EDITKEY);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
31
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
32 try{
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
33 bbs.createBoardMessage(boardName,author,msg,key);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
34 PrintWriter pw = _res.getWriter();
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
35 pw.write("successfully written");
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
36 }catch(Exception _e){
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
37 _res.setStatus(500);
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
38 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
39 }
d8ee57a1c2c6 add pom.xml and bbs
one
parents:
diff changeset
40 }