# HG changeset patch # User suruga # Date 1502102234 -32400 # Node ID 9722b51dede3668911b0dad53260bf60c8280de8 # Parent 124f90eccaa82c842aebab6fad92feadc4a03c39# Parent 0c7cdb0b280ed79cfb3a1b2c95086e04c037c833 merge diff -r 0c7cdb0b280e -r 9722b51dede3 src/main/java/jp/ac/u_ryukyu/ie/cr/bbs/browsing/FindNodeServlet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/bbs/browsing/FindNodeServlet.java Mon Aug 07 19:37:14 2017 +0900 @@ -0,0 +1,67 @@ +package jp.ac.u_ryukyu.ie.cr.bbs.browsing; + +import jp.ac.u_ryukyu.ie.cr.jungle.transaction.node.TreeNode; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.util.Iterator; + +public class FindNodeServlet extends HttpServlet +{ + private final BrowsingBulletinBoard bbs; + private final String showBoardMessagePath ; + private static final String PARAM_BOARD_NAME = "bname"; + + private static final long serialVersionUID = 1L; + + public FindNodeServlet(BrowsingBulletinBoard _bbs, String _showBoardMessagePath) + { + showBoardMessagePath = _showBoardMessagePath; + bbs = _bbs; + } + + public void doGet(HttpServletRequest _req,HttpServletResponse _res) + { + String bname = _req.getParameter(PARAM_BOARD_NAME); + System.out.println("write"); + + try{ + PrintWriter pw = _res.getWriter(); + pw.write("

find Node

"); + pw.write("
" + + "\n"); + pw.write("

key

\n"); + pw.write("

value

\n"); + pw.write("

\n"); + pw.write(""); + pw.flush(); + }catch(Exception _e){ + _res.setStatus(500); + } + } + + public void doPost(HttpServletRequest _req,HttpServletResponse _res) + { + String bname = _req.getParameter("bname"); + String key = _req.getParameter("key"); + String value = _req.getParameter("value"); + + try{ + Iterator iterator = bbs.findNode(bname, key, value); + PrintWriter pw = _res.getWriter(); + pw.write("

result

\n"); + while (iterator.hasNext()) { + TreeNode node = iterator.next(); + String childName = node.getAttributes().getString("NodeName"); + String path = bbs.getNodePath(bname, node).replace("<","").replace(">",""); + pw.write("

" +childName + " : path = <" + path + ">

"); + } + pw.flush(); + }catch(Exception _e){ + _res.setStatus(500); + } + } +} diff -r 0c7cdb0b280e -r 9722b51dede3 src/main/java/jp/ac/u_ryukyu/ie/cr/bbs/browsing/FindNodeservlet.java --- a/src/main/java/jp/ac/u_ryukyu/ie/cr/bbs/browsing/FindNodeservlet.java Mon Aug 07 19:33:54 2017 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -package jp.ac.u_ryukyu.ie.cr.bbs.browsing; - -import jp.ac.u_ryukyu.ie.cr.jungle.transaction.node.TreeNode; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.PrintWriter; -import java.util.Iterator; - -public class FindNodeServlet extends HttpServlet -{ - private final BrowsingBulletinBoard bbs; - private final String showBoardMessagePath ; - private static final String PARAM_BOARD_NAME = "bname"; - - private static final long serialVersionUID = 1L; - - public FindNodeServlet(BrowsingBulletinBoard _bbs, String _showBoardMessagePath) - { - showBoardMessagePath = _showBoardMessagePath; - bbs = _bbs; - } - - public void doGet(HttpServletRequest _req,HttpServletResponse _res) - { - String bname = _req.getParameter(PARAM_BOARD_NAME); - System.out.println("write"); - - try{ - PrintWriter pw = _res.getWriter(); - pw.write("

find Node

"); - pw.write("" + - "\n"); - pw.write("

key

\n"); - pw.write("

value

\n"); - pw.write("

\n"); - pw.write(""); - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } - - public void doPost(HttpServletRequest _req,HttpServletResponse _res) - { - String bname = _req.getParameter("bname"); - String key = _req.getParameter("key"); - String value = _req.getParameter("value"); - - try{ - Iterator iterator = bbs.findNode(bname, key, value); - PrintWriter pw = _res.getWriter(); - pw.write("

result

\n"); - while (iterator.hasNext()) { - TreeNode node = iterator.next(); - String childName = node.getAttributes().getString("NodeName"); - String path = bbs.getNodePath(bname, node).replace("<","").replace(">",""); - pw.write("

" +childName + " : path = <" + path + ">

"); - } - pw.flush(); - }catch(Exception _e){ - _res.setStatus(500); - } - } -}