1 package com.instantbank.collections.main.web; 2 3 import javax.servlet.ServletConfig; 4 import javax.servlet.ServletException; 5 import javax.servlet.http.HttpServlet; 6 import javax.servlet.http.HttpServletRequest; 7 import javax.servlet.http.HttpServletResponse; 8 import javax.servlet.http.HttpSession; 9 import java.io.IOException; 10 import javax.ejb.FinderException; 11 import com.instantbank.collections.util.FilterChain; 12 import com.instantbank.collections.util.InstantbankException; 13 14 public class LoginPageController extends HttpServlet { 15 private HttpSession session; 16 17 18 public void init(ServletConfig config) throws ServletException { 19 super.init(config); 20 } 21 22 23 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24 doPost(request, response); 25 } 26 27 28 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 29 String action; 30 com.instantbank.collections.util.FilterChain chain; 31 32 try { 33 action = request.getParameter("action"); 34 try { 35 if(action.equals("initialize")) { 36 chain = new com.instantbank.collections.util.FilterChain(true, getServletConfig().getServletContext()); 37 if(chain.processFilter(request, response)) { 38 return; 39 } 40 } 41 42 if(action.startsWith("initialize")) { 43 initialize(request, response); 44 } 45 else { 46 throw new InstantbankException("000001", "Action " + action + " not supported"); 47 } 48 } 49 catch(Exception e) { 50 throw new InstantbankException(e, "000002", "Failed to execute action " + action); 51 } 52 } 53 catch(InstantbankException e) { 54 session.setAttribute("Exception", e); 55 response.sendRedirect("../main_web/ControllerError.jsp?showTechnical=0"); 56 } 57 } 58 59 60 private void initialize(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, FinderException, Exception { 61 response.sendRedirect("../main_web/LoginPage.jsp"); 62 } 63 64 65 public String getServletInfo() { 66 return "com.instantbank.collections.main.web.LoginPageController Information"; 67 } 68 } 69 70