KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > rice > rubis > servlets > PutBidAuth


1 package edu.rice.rubis.servlets;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.servlet.ServletException JavaDoc;
6 import javax.servlet.http.HttpServlet JavaDoc;
7 import javax.servlet.http.HttpServletRequest JavaDoc;
8 import javax.servlet.http.HttpServletResponse JavaDoc;
9
10 /** This servlets display the page authentifying the user
11  * to allow him to put a bid on an item.
12  * It must be called this way :
13  * <pre>
14  * http://..../PutBidAuth?itemId=xx where xx is the id of the item
15  * /<pre>
16  * @author <a HREF="mailto:cecchet@rice.edu">Emmanuel Cecchet</a> and <a HREF="mailto:julie.marguerite@inrialpes.fr">Julie Marguerite</a>
17  * @version 1.0
18  */

19
20 public class PutBidAuth extends HttpServlet JavaDoc
21 {
22
23
24   public void doGet(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
25     throws IOException JavaDoc, ServletException JavaDoc
26   {
27     ServletPrinter sp = null;
28     sp = new ServletPrinter(response, "PubBidAuth");
29
30     String JavaDoc value = request.getParameter("itemId");
31     if ((value == null) || (value.equals("")))
32     {
33       sp.printHTMLheader("RUBiS ERROR: Authentification for bidding");
34       sp.printHTML(
35         "No item identifier received - Cannot process the request<br>");
36       sp.printHTMLfooter();
37       return;
38     }
39
40     sp.printHTMLheader("RUBiS: User authentification for bidding");
41     sp.printFile(Config.HTMLFilesPath + "/put_bid_auth_header.html");
42     sp.printHTML("<input type=hidden name=\"itemId\" value=\"" + value + "\">");
43     sp.printFile(Config.HTMLFilesPath + "/auth_footer.html");
44     sp.printHTMLfooter();
45   }
46
47   public void doPost(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
48     throws IOException JavaDoc, ServletException JavaDoc
49   {
50     doGet(request, response);
51   }
52 }
53
Popular Tags