package yoonforh.bbs; /** * Delete Servlet * Copyright (c) 1997 Yoon Kyung Koo. All rights reserved. * * contact via yoonforh@moon.daewoo.co.kr * * first release date 1997/10/07 * @version 1.01a 1998/06/01 * @author Yoon Kyung Koo */ import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class DeleteServlet 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 articleNo=-1; try { articleNo=Integer.parseInt(req.getParameter("number")); } catch (NumberFormatException nfe) {} BBSUtil.printDeleteHeader(out, articleNo); BBSUtil.printDeleteChallenge(out, category, articleNo); BBSUtil.printDeleteFooter(out, category, articleNo); } public String getServletInfo() { return "A servlet that shows the requested article on the web board"; } }