KickJava   Java API By Example, From Geeks To Geeks.

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


1 package edu.rice.rubis.beans.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
21 public class PutBidAuth extends HttpServlet JavaDoc
22 {
23
24   /**
25    * Describe <code>doGet</code> method here.
26    *
27    * @param request a <code>HttpServletRequest</code> value
28    * @param response a <code>HttpServletResponse</code> value
29    * @exception IOException if an error occurs
30    * @exception ServletException if an error occurs
31    */

32   public void doGet(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws IOException JavaDoc, ServletException JavaDoc
33   {
34     ServletPrinter sp = null;
35     sp = new ServletPrinter(response, "PubBidAuth");
36     
37     String JavaDoc value = request.getParameter("itemId");
38     if ((value == null) || (value.equals("")))
39     {
40       sp.printHTMLheader("RUBiS ERROR: Authentification for bidding");
41       sp.printHTML("No item identifier received - Cannot process the request<br>");
42       sp.printHTMLfooter();
43       return ;
44     }
45
46     sp.printHTMLheader("RUBiS: User authentification for bidding");
47     sp.printFile(Config.HTMLFilesPath+"/put_bid_auth_header.html");
48     sp.printHTML("<input type=hidden name=\"itemId\" value=\""+value+"\">");
49     sp.printFile(Config.HTMLFilesPath+"/auth_footer.html");
50     sp.printHTMLfooter();
51   }
52
53   /**
54    * Call the <code>doGet</code> method.
55    *
56    * @param request a <code>HttpServletRequest</code> value
57    * @param response a <code>HttpServletResponse</code> value
58    * @exception IOException if an error occurs
59    * @exception ServletException if an error occurs
60    */

61   public void doPost(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws IOException JavaDoc, ServletException JavaDoc
62   {
63     doGet(request, response);
64   }
65 }
66
Popular Tags