1 package edu.rice.rubis.servlets; 2 3 import java.io.IOException ; 4 5 import javax.servlet.ServletException ; 6 import javax.servlet.http.HttpServlet ; 7 import javax.servlet.http.HttpServletRequest ; 8 import javax.servlet.http.HttpServletResponse ; 9 10 19 20 public class BuyNowAuth extends HttpServlet 21 { 22 23 24 25 public void doGet(HttpServletRequest request, HttpServletResponse response) 26 throws IOException , ServletException 27 { 28 ServletPrinter sp = null; 29 sp = new ServletPrinter(response, "BuyNowAuth"); 30 31 String value = request.getParameter("itemId"); 32 if ((value == null) || (value.equals(""))) 33 { 34 sp.printHTMLheader("RUBiS ERROR: Authentification for buying an item"); 35 sp.printHTML( 36 "No item identifier received - Cannot process the request<br>"); 37 sp.printHTMLfooter(); 38 return; 39 } 40 41 sp.printHTMLheader("RUBiS: User authentification for buying an item"); 42 sp.printFile(Config.HTMLFilesPath + "/buy_now_auth_header.html"); 43 sp.printHTML("<input type=hidden name=\"itemId\" value=\"" + value + "\">"); 44 sp.printFile(Config.HTMLFilesPath + "/auth_footer.html"); 45 sp.printHTMLfooter(); 46 } 47 48 49 public void doPost(HttpServletRequest request, HttpServletResponse response) 50 throws IOException , ServletException 51 { 52 doGet(request, response); 53 } 54 } 55 | Popular Tags |