Mercurial > hg > Database > jungle-network
annotate src/main/java/app/bbs/ShowMessageWithTimeStampServlet.java @ 166:564f683b7aef
Matrix Date type insert ok
but bad source
author | tatsuki |
---|---|
date | Mon, 28 Jul 2014 17:02:31 +0900 |
parents | b3d5fbe95b9a |
children | 91f6dd655a01 |
rev | line source |
---|---|
146
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 package app.bbs; |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 import java.io.PrintWriter; |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 import javax.servlet.http.HttpServlet; |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 import javax.servlet.http.HttpServletRequest; |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 import javax.servlet.http.HttpServletResponse; |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 |
155 | 9 import org.eclipse.jetty.util.thread.ThreadPool; |
10 | |
146
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BoardMessage; |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 |
156 | 13 public class ShowMessageWithTimeStampServlet extends HttpServlet { |
165 | 14 /** |
146
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 * |
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 */ |
165 | 17 private static final long serialVersionUID = 1L; |
18 private final NetworkBulletinBoard bbs; | |
19 private final String createBoardMessagePath; | |
20 private final String editMessagePath; | |
21 private final String showMatrixPath; | |
156 | 22 |
165 | 23 private static final String PARAM_BOARD_NAME = "bname"; |
146
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 |
165 | 25 public ShowMessageWithTimeStampServlet(NetworkBulletinBoard _bbs, |
26 String _createBoardMessagePath, String _editMessagePath, String _showMatrixPath, | |
27 ThreadPool thp) { | |
28 bbs = _bbs; | |
29 showMatrixPath = _showMatrixPath; | |
30 createBoardMessagePath = _createBoardMessagePath; | |
31 editMessagePath = _editMessagePath; | |
32 } | |
156 | 33 |
165 | 34 public void doGet(HttpServletRequest _req, HttpServletResponse _res) { |
35 final String bname = _req.getParameter(PARAM_BOARD_NAME); | |
36 try { | |
37 printBoard(bname, _res.getWriter()); | |
38 } catch (Exception _e) { | |
39 _res.setStatus(500); | |
40 } | |
41 } | |
146
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 |
165 | 43 private void printBoard(String _bname, PrintWriter _pw) throws Exception { |
44 _pw.write("<html><body>\n"); | |
45 _pw.write("<h1>" + _bname + "</h1>\n"); | |
46 _pw.write("<p>Latest renew time : " + bbs.getRenewTime(_bname) | |
47 + "</p>\n"); | |
166 | 48 |
165 | 49 _pw.write("<form action='" + createBoardMessagePath |
50 + "' method='POST'\n"); | |
51 _pw.write("<p>Author : <input type='text' name='author'/> <input type='hidden' name='bname' value='" | |
52 + _bname | |
53 + "'/> EditKey : <input type='text' name='key'/></p>\n"); | |
54 _pw.write("<p>Message<br/> <input type='textarea' name='msg'/> </p>\n"); | |
55 _pw.write("<p><input type='submit' value='submit'/></p>\n"); | |
156 | 56 |
165 | 57 |
58 for (BoardMessage msg : bbs.getMessages(_bname)) {//フォルダの表示 | |
59 _pw.write("<hr/>"); | |
60 _pw.write("<p><b>" + msg.getAuthor() + "</b></p>"); | |
61 _pw.write("<p>" + msg.getMessage() + "</p>"); | |
62 _pw.write("<small><a href=" + showMatrixPath + "?bname=" + _bname | |
63 + "&uuid=0" + ">"+msg.getMessage()+"(show matrix)"+"</a></small><br>"); | |
64 _pw.write("<small><a href='" + editMessagePath + "?bname=" + _bname | |
65 + "&uuid=" + msg.getUUID() + "'>edit</a></small>"); | |
66 } | |
156 | 67 |
165 | 68 //forコメントの表示 |
69 _pw.write("</body></html>"); | |
70 _pw.flush(); | |
71 } | |
146
29734d7d6521
Added ShowMessageWithTimeStampServlet
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 } |