@Override
 public void execute(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   String email = request.getParameter("email");
   String password = request.getParameter("password");
   String confirmPassword = request.getParameter("confirm_password");
   HttpSession session = request.getSession();
   ResourceBundle bundle = (ResourceBundle) session.getAttribute("bundle");
   if (password.equals(confirmPassword)) {
     User user = service.getByEmail(email);
     if (user != null) {
       user.setPassword(new HashMD5().hash(password));
       service.update(user.getId(), user);
       session.setAttribute(
           "toastr_notification",
           "success|" + UTF8.encoding(bundle.getString("restore" + ".notification.success")));
       response.sendRedirect(ServerLocationUtils.getServerPath(request) + "/login");
       return;
     }
     response.sendError(HttpServletResponse.SC_NOT_FOUND);
   } else {
     request.setAttribute("email", email);
     request.setAttribute(
         "toastr_notification",
         "error|" + UTF8.encoding(bundle.getString("restore" + ".notification.match")));
     request.getRequestDispatcher("jsp/user/pwrestore_newpw.jsp").forward(request, response);
   }
 }
  @Override
  public void execute(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int offset = Integer.parseInt(request.getParameter("iDisplayStart"));
    int limit = Integer.parseInt(request.getParameter("iDisplayLength"));

    Integer wallId = null;
    try {
      wallId = service.getById(Integer.parseInt(request.getParameter("postId"))).getWallId();
    } catch (NumberFormatException ignored) {
    }

    List<PostingTask> posts =
        service.getByUserIdWithParameters(
            user.getId(),
            offset,
            limit,
            "POSTED",
            request.getParameter("sSearch"),
            request.getParameter("sSortDir_0"),
            wallId);
    int postCount =
        service.getCountAllByUserIdWithParameters(
            user.getId(), "POSTED", request.getParameter("sSearch"), wallId);

    JSONObject result = new JSONObject();
    JSONArray array = new JSONArray();

    posts = loadingStatistics(posts, user.getId());
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm");
    for (PostingTask post : posts) {
      try {
        JSONArray row = new JSONArray();
        row.put(
            post.getPost().getMessage().length() > 45
                ? post.getPost().getMessage().substring(0, 42) + "..."
                : post.getPost().getMessage());
        row.put(post.getOwner().getName());
        row.put(post.getFullId());
        row.put(dateFormat.format(post.getPostTime()));
        PostingTaskImpl.Stats stats = post.getStats();
        String data = stats.getLikes() + "|" + stats.getRePosts() + "|" + stats.getComments();
        row.put(data);
        row.put(post.getPostId());
        row.put(post.getId());
        array.put(row);
      } catch (Exception e) {
        LOG.warn("Post id = " + post.getPostId() + " deleted.");
        service.delete(post.getId());
      }
    }
    result.put("iTotalDisplayRecords", postCount);
    result.put("aaData", array);
    response.setContentType("application/json");
    response.setCharacterEncoding("UTF-8");
    response.getWriter().print(result.toString());
  }