import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class RequestType3 extends HttpServlet {

  boolean debug;

  public void init() throws ServletException {
    String debugParam = getInitParameter("debug");
    if (debugParam != null &&
        debugParam.equalsIgnoreCase("true")) {
      debug = true;
    } else {
      debug = false;
    }
  }

  public void doGet(HttpServletRequest req, HttpServletResponse rsp)
                throws ServletException, IOException {
    rsp.setContentType("text/html");
    PrintWriter out = rsp.getWriter();

    String requestType = req.getMethod();

    out.println("<html>");
    out.println("<head><title> A Web page </title></head>");
    out.println("<body>");

    if (debug) out.println("<p>This page is the result of a " +
                           requestType + " request.</p>");

    out.println("<p>Regular page content here...</p>");
    out.println("</body></html>");
  }

  public void doPost(HttpServletRequest req, HttpServletResponse rsp)
                throws ServletException, IOException {
    doGet(req,rsp);
  }

}
