@RequestMapping(value = "updateBlog.do")
  public @ResponseBody String updateBlog(String blogJson, HttpServletRequest request) {
    JSONObject blogObj = JSON.parseObject(blogJson);
    Blog blog = new Blog();
    blog.setId(blogObj.getString("id"));
    blog.setTitle(blogObj.getString("title"));
    blog.setContent(blogObj.getString("content"));

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();

    blog.setLastUpdatedAt(sdf.format(date));

    //		blog.setCategories(blogObj.getString("categories"));
    return blogService.updateBlog(blog);
  }
  @RequestMapping(value = "newBlog.do")
  public @ResponseBody String newBlog(String blogJson, HttpServletRequest request) {
    JSONObject blogObj = JSON.parseObject(blogJson);
    Blog blog = new Blog();
    blog.setTitle(blogObj.getString("title"));
    blog.setContent(blogObj.getString("content"));

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();
    blog.setCreatedAt(sdf.format(date));
    blog.setLastUpdatedAt(sdf.format(date));

    User createdBy = (User) request.getSession().getAttribute("user");
    blog.setCreatedBy(createdBy);
    blog.setCategories(blogObj.getString("categories"));
    return blogService.newBlog(blog);
  }
 @RequestMapping(value = "deleteBlog.do")
 public @ResponseBody String deleteBlog(String id) {
   return blogService.deleteBlog(id);
 }
 @RequestMapping(value = "getOneBlog.do")
 public @ResponseBody String getOneBlog(String id) {
   String blogJson = JSON.toJSONString(blogService.getBlogById(id));
   return blogJson;
 }
 @RequestMapping(value = "getBlogsByCategory.do")
 public @ResponseBody String getBlogsByCategory(String category) {
   String allBlogsJson = JSON.toJSONString(blogService.getBlogsByCategory(category));
   return allBlogsJson;
 }