/**
   * *************************************************************************************************
   */
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    ConnectToDB ctdb = null;

    // Get the session
    HttpSession session = req.getSession();

    User user = (User) session.getAttribute("user");
    if (user == null) {
      this.redirectToLogin(req, res);
    } else {
      this.checkSessionScheme(req, res);
      if (user.isAdmin() == false) {
        res.sendError(WebConstants.ACCESS_DENIED, "Access denied.");
      } else {
        this.printHeader(out);
        this.printLayoutMastHead(out, user);
        this.printLayoutContent(out);
        try {
          ctdb = new ConnectToDB();
          Vector waitingUsers = ctdb.getWaitingUsers();
          if (waitingUsers.size() == 0) {
            out.println("<p><B> There is no entry in the waiting user list !</B> </p>");
          }
          for (int i = 0; i < waitingUsers.size(); i++) {
            // printForm(out,(User)(waitingUsers.get(i)));

            this.printNewEntry(out, (User) (waitingUsers.get(i)));
          }
        } catch (Exception e) {
          out.println("<p><B> Can not print the form</B> </p>");

          logger.error("ERROR IN DOGET");
          logger.error(e.getMessage(), e);

        } finally {
          if (ctdb != null) {
            ctdb.closeStatement();
            ctdb.closeConnection();
          }
        }
        // out.println("</BODY>");
        this.printLayoutFooter(out);
      }
    }
  }
Ejemplo n.º 2
0
  /// gsn/MyLogoutHandlerServlet
  private void printForm(PrintWriter out, User user) {

    ConnectToDB ctdb = null;
    try {
      ctdb = new ConnectToDB();

      this.printLayoutMastHead(out, user);

      this.printLayoutContent(out, user, ctdb);
      this.printLayoutSideBar(out, user, ctdb);
      this.printLayoutFooter(out);
    } catch (Exception e) {

      logger.error("ERROR IN printForm");
      logger.error(e.getMessage(), e);

    } finally {
      if (ctdb != null) {
        ctdb.closeStatement();
        ctdb.closeConnection();
      }
    }
  }