KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > performance > TestServlet


1 /*
2  * TestServlet.java
3  *
4  * Created on 26. kvten 2004, 14:10
5  */

6
7 package org.netbeans.test.performance;
8
9 import java.io.*;
10 import java.net.*;
11
12 import javax.servlet.*;
13 import javax.servlet.http.*;
14
15 /**
16  *
17  * @author lm97939
18  * @version
19  */

20 public class TestServlet extends HttpServlet {
21     
22     /** Initializes the servlet.
23      */

24     public void init(ServletConfig config) throws ServletException {
25         super.init(config);
26         
27     }
28     
29     /** Destroys the servlet.
30      */

31     public void destroy() {
32         
33     }
34     
35     /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
36      * @param request servlet request
37      * @param response servlet response
38      */

39     protected void processRequest(HttpServletRequest request, HttpServletResponse response)
40     throws ServletException, IOException {
41         response.setContentType("text/html");
42         PrintWriter out = response.getWriter();
43         /* TODO output your page here
44         out.println("<html>");
45         out.println("<head>");
46         out.println("<title>Servlet</title>");
47         out.println("</head>");
48         out.println("<body>");
49          
50         out.println("</body>");
51         out.println("</html>");
52          */

53         out.close();
54     }
55     
56     /** Handles the HTTP <code>GET</code> method.
57      * @param request servlet request
58      * @param response servlet response
59      */

60     protected void doGet(HttpServletRequest request, HttpServletResponse response)
61     throws ServletException, IOException {
62         processRequest(request, response);
63     }
64     
65     /** Handles the HTTP <code>POST</code> method.
66      * @param request servlet request
67      * @param response servlet response
68      */

69     protected void doPost(HttpServletRequest request, HttpServletResponse response)
70     throws ServletException, IOException {
71         processRequest(request, response);
72     }
73     
74     /** Returns a short description of the servlet.
75      */

76     public String JavaDoc getServletInfo() {
77         return "Short description";
78     }
79     
80 }
81
Popular Tags