KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > www > WError


1 package org.compiere.www;
2
3 import javax.servlet.*;
4 import javax.servlet.http.*;
5 import java.io.*;
6 import java.util.*;
7
8 public class WError extends HttpServlet
9 {
10     static final private String JavaDoc CONTENT_TYPE = "text/html";
11     static final private String JavaDoc DOC_TYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" +
12       " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
13     /**Initialize global variables*/
14     public void init(ServletConfig config) throws ServletException
15     {
16         super.init(config);
17     }
18     /**Process the HTTP Get request*/
19     public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
20     {
21         response.setContentType(CONTENT_TYPE);
22         PrintWriter out = response.getWriter();
23         out.println("<?xml version=\"1.0\"?>");
24         out.println(DOC_TYPE);
25         out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">");
26         out.println("<head><title>WError</title></head>");
27         out.println("<body>");
28         out.println("<p>The servlet has received a GET. This is the reply.</p>");
29         out.println("</body></html>");
30     }
31     /**Process the HTTP Post request*/
32     public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
33     {
34         response.setContentType(CONTENT_TYPE);
35         PrintWriter out = response.getWriter();
36         out.println("<?xml version=\"1.0\"?>");
37         out.println(DOC_TYPE);
38         out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">");
39         out.println("<head><title>WError</title></head>");
40         out.println("<body>");
41         out.println("<p>The servlet has received a POST. This is the reply.</p>");
42         out.println("</body></html>");
43     }
44     /**Clean up resources*/
45     public void destroy()
46     {
47     }
48 }
Popular Tags