Пример #1
0
  @POST
  public Response addComment(
      @PathParam("messageId") long messageId, @Context UriInfo uriInfo, Comment comment) {
    Comment newComment = commentService.addComment(messageId, comment);

    URI uri = uriInfo.getAbsolutePathBuilder().path(String.valueOf(newComment.getId())).build();
    return Response.created(uri).entity(newComment).build();
  }
Пример #2
0
 @PUT
 @Path("/{commentId}")
 public Comment updateComment(
     @PathParam("messageId") long messageId,
     @PathParam("commentId") long commentId,
     Comment comment) {
   comment.setId(commentId);
   return commentService.updateComment(messageId, comment);
 }
Пример #3
0
 @GET
 @Path("/{commentId}")
 public Comment getComment(
     @PathParam("messageId") long messageId, @PathParam("commentId") long commentId) {
   return commentService.getComment(messageId, commentId);
 }
Пример #4
0
 @DELETE
 @Path("/{commentId}")
 public Comment deleteComment(
     @PathParam("messageId") long messageId, @PathParam("commentId") long commentId) {
   return commentService.removeComment(messageId, commentId);
 }
Пример #5
0
 @GET
 public List<Comment> getAllComments(@PathParam("messageId") long messageId) {
   return commentService.getAllComments(messageId);
 }