PageRenderTime 31ms CodeModel.GetById 22ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/Prototipo/Servlet/src/java/googleSitePost.java

http://prototipomemoria.googlecode.com/
Java | 85 lines | 33 code | 8 blank | 44 comment | 0 complexity | 3b3c000610a1029e85ec58f315bb7af2 MD5 | raw file
 1/*
 2 * To change this template, choose Tools | Templates
 3 * and open the template in the editor.
 4 */
 5
 6
 7import java.io.IOException;
 8import java.io.PrintWriter;
 9import javax.servlet.ServletException;
10import javax.servlet.annotation.WebServlet;
11import javax.servlet.http.HttpServlet;
12import javax.servlet.http.HttpServletRequest;
13import javax.servlet.http.HttpServletResponse;
14
15/**
16 *
17 * @author Fran
18 */
19@WebServlet(name="googleSitePost", urlPatterns={"/googleSitePost"})
20public class googleSitePost extends HttpServlet {
21   
22    /** 
23     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
24     * @param request servlet request
25     * @param response servlet response
26     * @throws ServletException if a servlet-specific error occurs
27     * @throws IOException if an I/O error occurs
28     */
29    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
30    throws ServletException, IOException {
31        response.setContentType("text/html;charset=UTF-8");
32        PrintWriter out = response.getWriter();
33        try {
34            /* TODO output your page here
35            out.println("<html>");
36            out.println("<head>");
37            out.println("<title>Servlet googleSitePost</title>");  
38            out.println("</head>");
39            out.println("<body>");
40            out.println("<h1>Servlet googleSitePost at " + request.getContextPath () + "</h1>");
41            out.println("</body>");
42            out.println("</html>");
43            */
44        } finally { 
45            out.close();
46        }
47    } 
48
49    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
50    /** 
51     * Handles the HTTP <code>GET</code> method.
52     * @param request servlet request
53     * @param response servlet response
54     * @throws ServletException if a servlet-specific error occurs
55     * @throws IOException if an I/O error occurs
56     */
57    @Override
58    protected void doGet(HttpServletRequest request, HttpServletResponse response)
59    throws ServletException, IOException {
60        processRequest(request, response);
61    } 
62
63    /** 
64     * Handles the HTTP <code>POST</code> method.
65     * @param request servlet request
66     * @param response servlet response
67     * @throws ServletException if a servlet-specific error occurs
68     * @throws IOException if an I/O error occurs
69     */
70    @Override
71    protected void doPost(HttpServletRequest request, HttpServletResponse response)
72    throws ServletException, IOException {
73        processRequest(request, response);
74    }
75
76    /** 
77     * Returns a short description of the servlet.
78     * @return a String containing servlet description
79     */
80    @Override
81    public String getServletInfo() {
82        return "Short description";
83    }// </editor-fold>
84
85}