private void cancelEditPost(HttpServletRequest req, HttpServletResponse resp) { ShubUser user = (ShubUser) req.getSession().getAttribute("user"); String date = req.getParameter("hiddenDate").toString(); Post post = user.getNewsfeed().getPost(date); post.setIsEditing(false); req.getSession().removeAttribute("deleteDate"); req.getSession().setAttribute("user", user); try { resp.sendRedirect("/signedIn.jsp"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private void saveEditPost(HttpServletRequest req, HttpServletResponse resp) { ShubUser user = (ShubUser) req.getSession().getAttribute("user"); String overallText = voidOverallChecking(""); String fbText = voidFacebookChecking(req.getParameter("fbEditText"), overallText, req); String twitterText = voidTwitterChecking(req.getParameter("twitterEditText"), overallText, req); System.out.println(fbText + " twitter's is " + twitterText); req.getSession().removeAttribute("fbEditText"); req.getSession().removeAttribute("twitterEditText"); Blob blob = (Blob) req.getSession().getAttribute("curBlob"); String date = req.getParameter("hiddenDate").toString(); Post post = user.getNewsfeed().getPost(date); BlobKey key = post.getPicture(); req.getSession().setAttribute("blobKey", key); req.getSession().setAttribute("editImageURL", post.getBlobURL()); req.getSession().setAttribute("deleteDate", date); if (blob != null && req.getParameter("myPhoto") != null) { // user.postWithMedia(overallText, fbText, twitterText, req, resp); } else { try { user.post(overallText, fbText, twitterText, req, resp); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // Delete the previous post // Post post = user.getNewsfeed().getPost(date); // try { // user.deletePost(req, resp, post); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } }