notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/controller/rest/JPANotificationRESTController.java
@RequestMapping(value = "/{notificationId}/events", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    @ResponseBody
    public EventDTO createEvent(HttpServletRequest req, HttpServletResponse resp,
            @PathVariable("notificationId") long notificationId,
            @RequestBody EventDTO event) {
        EventDTO dto = restService.createEvent(notificationId, event);
        if (dto == null) {
            resp.setStatus(HttpStatus.NOT_FOUND.value());
            return null;
        }

        String url = getSingleNotificationRESTUrl(req, notificationId) + "/state/" + dto.getId();
        resp.addHeader("Location", url);

        return dto;
    }
@RequestMapping(value = "/{notificationId}/events", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    @ResponseBody
    public EventDTO createEvent(HttpServletRequest req, HttpServletResponse resp,
            @PathVariable("notificationId") long notificationId,
            @RequestBody EventDTO event) {
        EventDTO dto = restService.createEvent(notificationId, event);
        if (dto == null) {
            resp.setStatus(HttpStatus.NOT_FOUND.value());
            return null;
        }

        String url = getSingleNotificationRESTUrl(req, notificationId) + "/state/" + dto.getId();
        resp.addHeader("Location", url);

        return dto;
    }
@ RequestMapping ( value = "/{notificationId}/events" , method = RequestMethod . POST ) @ ResponseStatus ( HttpStatus . CREATED ) @ ResponseBody public EventDTO createEvent ( HttpServletRequest req , HttpServletResponse resp , @ PathVariable ( "notificationId" ) long notificationId , @ RequestBody EventDTO event ) { EventDTO dto = restService . createEvent ( notificationId , event ) ; if ( dto == null ) { resp . setStatus ( HttpStatus . NOT_FOUND . value ( ) ) ; return null ; } String url = getSingleNotificationRESTUrl ( req , notificationId ) + "/state/" + dto . getId ( ) ; resp . addHeader ( "Location" , url ) ; return dto ; }
Create a new event.

@param req the Http request
@param resp the Http response
@param notificationId the notification id
@param event the event id
@return The newly persisted object
Create a new event .