Exemplo n.º 1
0
  /**
   * 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
   */
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    XDebug xdebug = new XDebug(request);
    request.setAttribute(QueryBuilder.XDEBUG_OBJECT, xdebug);

    try {
      if (validate(request)) {
        setGeneticProfiles(request);
      }

      if (request.getAttribute(ERROR) != null) {
        forwardToErrorPage(request, response, (String) request.getAttribute(ERROR), xdebug);
      } else {
        RequestDispatcher dispatcher =
            getServletContext().getRequestDispatcher("/WEB-INF/jsp/dashboard/dashboard.jsp");
        dispatcher.forward(request, response);
      }

    } catch (DaoException e) {
      xdebug.logMsg(this, "Got Database Exception:  " + e.getMessage());
      forwardToErrorPage(
          request, response, "An error occurred while trying to connect to the database.", xdebug);
    }
  }