@RequestMapping(
      value = "/form",
      method = RequestMethod.POST,
      consumes = "application/x-www-form-urlencoded")
  @ResponseBody
  public Event addEventForm(
      @RequestParam String keyword,
      @RequestParam String theDay,
      @RequestParam String startDate,
      @RequestParam String duration,
      @RequestParam String initialEvent) {
    if (diaryHelper.md5(keyword).equals(password)) {
      Event event = new Event();
      event.setDescription(initialEvent);
      event.setDuration(diaryHelper.getDuration(duration));
      GregorianCalendar startDateCal = diaryHelper.getStartDateCal(startDate);
      event.setStartTime(startDateCal.getTime());

      event.setId(
          diaryService.addEvent(DateUtil.resetHMS(diaryHelper.getDayCal(theDay).getTime()), event));

      return event;
    }
    return new Event();
  }
 @RequestMapping(value = "/{year}/{month}/{day}", method = RequestMethod.GET)
 @ResponseBody
 public List<Event> getEventsForADay(
     @PathVariable int year, @PathVariable int month, @PathVariable int day) {
   Calendar c = GregorianCalendar.getInstance();
   c.set(year, month, day);
   return diaryService.getEventsForADay(DateUtil.resetHMS(c.getTime()));
 }
 @RequestMapping(value = "/{year}/{month}/{day}", method = RequestMethod.POST)
 public void addEvent(
     @RequestBody Event event,
     @PathVariable int year,
     @PathVariable int month,
     @PathVariable int day) {
   Calendar c = GregorianCalendar.getInstance();
   c.set(year, month, day);
   diaryService.addEvent(DateUtil.resetHMS(c.getTime()), event);
 }