コード例 #1
0
 /**
  * Write the list of upcoming events to the body of the response. Only matches 'GET /events'
  * requests for JSON content; a 404 is sent otherwise. TODO send a 406 if an unsupported
  * representation, such as XML, is requested. See SPR-7353.
  */
 @RequestMapping(value = "/events", method = RequestMethod.GET, produces = "application/json")
 public @ResponseBody List<Event> upcomingEvents(
     @RequestParam(value = "after", required = false) @DateTimeFormat(iso = ISO.DATE_TIME)
         Long afterMillis) {
   return eventRepository.findUpcomingEvents(afterMillis);
 }
コード例 #2
0
 /** Render the list of upcoming events as HTML in the client's web browser. */
 @RequestMapping(value = "/events", method = RequestMethod.GET, produces = "text/html")
 public String upcomingEventsView(Model model, DateTimeZone timeZone) {
   model.addAttribute(eventRepository.findUpcomingEvents(new DateTime(timeZone).getMillis()));
   return "events/list";
 }