package yoonforh.bbs; /** * List Servlet * Copyright (c) 1997 Yoon Kyung Koo. All rights reserved. * * contact via yoonforh@interpia.net * * first release date 1997/10/07 * @version 1.01 1997/10/17 * @author Yoon Kyung Koo */ import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class ListServlet extends HttpServlet { public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { //value chosen to limit denial of service if (req.getContentLength() > 8*1024) { res.setContentType("text/html"); ServletOutputStream out = res.getOutputStream(); out.println("Too big"); out.println("

Error - content length >8k not "); out.println("

"); } else { doGet(req, res); } } public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); ServletOutputStream out = res.getOutputStream(); String category=req.getParameter("cate"); int index=new Integer(req.getParameter("start")).intValue(); boolean isNext=((new Integer(req.getParameter("dir")).intValue())>0); BBSUtil.printListHeader(out); int returnIndex[]=new int[2]; returnIndex=BBSUtil.printArticleList(out, category, index, 10, isNext); BBSUtil.printListFooter(out, category, returnIndex[0], returnIndex[1]); } public String getServletInfo() { return "A servlet that shows the requested article on the web board"; } }