src/main/java/org/openimmunizationsoftware/pt/servlet/LoginServlet.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    AppReq appReq = new AppReq(request, response);
    try {
      Session dataSession = appReq.getDataSession();
      String action = appReq.getAction();
      PrintWriter out = appReq.getOut();
      boolean loginSuccess = false;
      if (action != null) {
        if (action.equals(ACTION_LOGIN)) {
          loginSuccess = login(request, appReq, dataSession, loginSuccess);
        } else if (action.equals(ACTION_LOGOUT)) {
          appReq.logout();
        }
      }
      if (!loginSuccess) {
        String username = request.getParameter("username");
        if (username == null) {
          username = "";
        }
        String password = request.getParameter("password");
        if (password == null) {
          password = "";
        }
        try {
          printHtmlHead(appReq);
          printLoginForm(out, username, password);
          printHtmlFoot(appReq);
        } finally {
          appReq.close();
        }
      } else {
        RequestDispatcher dispatcher = request.getRequestDispatcher("HomeServlet");
        dispatcher.forward(request, response);
        return;
      }
    } finally {
      appReq.close();
    }
  }
/**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
   * methods.
   * 
   * @param request
   *          servlet request
   * @param response
   *          servlet response
   * @throws ServletException
   *           if a servlet-specific error occurs
   * @throws IOException
   *           if an I/O error occurs
   */
Processes requests for both HTTP GET and POST
methods.

@param request
servlet request
@param response
servlet response
@throws ServletException
if a servlet-specific error occurs
@throws IOException
if an I/O error occurs
Processes requests for both HTTP GET and POST methods . @param request servlet request @param response servlet response @throws ServletException if a servlet - specific error occurs @throws IOException if an I / O error occurs
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    AppReq appReq = new AppReq(request, response);
    try {
      Session dataSession = appReq.getDataSession();
      String action = appReq.getAction();
      PrintWriter out = appReq.getOut();
      boolean loginSuccess = false;
      if (action != null) {
        if (action.equals(ACTION_LOGIN)) {
          loginSuccess = login(request, appReq, dataSession, loginSuccess);
        } else if (action.equals(ACTION_LOGOUT)) {
          appReq.logout();
        }
      }
      if (!loginSuccess) {
        String username = request.getParameter("username");
        if (username == null) {
          username = "";
        }
        String password = request.getParameter("password");
        if (password == null) {
          password = "";
        }
        try {
          printHtmlHead(appReq);
          printLoginForm(out, username, password);
          printHtmlFoot(appReq);
        } finally {
          appReq.close();
        }
      } else {
        RequestDispatcher dispatcher = request.getRequestDispatcher("HomeServlet");
        dispatcher.forward(request, response);
        return;
      }
    } finally {
      appReq.close();
    }
  }
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { AppReq appReq = new AppReq ( request , response ) ; try { Session dataSession = appReq . getDataSession ( ) ; String action = appReq . getAction ( ) ; PrintWriter out = appReq . getOut ( ) ; boolean loginSuccess = false ; if ( action != null ) { if ( action . equals ( ACTION_LOGIN ) ) { loginSuccess = login ( request , appReq , dataSession , loginSuccess ) ; } else if ( action . equals ( ACTION_LOGOUT ) ) { appReq . logout ( ) ; } } if ( ! loginSuccess ) { String username = request . getParameter ( "username" ) ; if ( username == null ) { username = "" ; } String password = request . getParameter ( "password" ) ; if ( password == null ) { password = "" ; } try { printHtmlHead ( appReq ) ; printLoginForm ( out , username , password ) ; printHtmlFoot ( appReq ) ; } finally { appReq . close ( ) ; } } else { RequestDispatcher dispatcher = request . getRequestDispatcher ( "HomeServlet" ) ; dispatcher . forward ( request , response ) ; return ; } } finally { appReq . close ( ) ; } }
Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 methods.
Processes requests for both HTTP <code > GET< / code > and <code > POST< / code > methods .