Ejemplo n.º 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();
  }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 @GET
 @Path("/{commentId}")
 public Comment getComment(
     @PathParam("messageId") long messageId, @PathParam("commentId") long commentId) {
   return commentService.getComment(messageId, commentId);
 }
Ejemplo n.º 4
0
 @DELETE
 @Path("/{commentId}")
 public Comment deleteComment(
     @PathParam("messageId") long messageId, @PathParam("commentId") long commentId) {
   return commentService.removeComment(messageId, commentId);
 }
Ejemplo n.º 5
0
 @GET
 public List<Comment> getAllComments(@PathParam("messageId") long messageId) {
   return commentService.getAllComments(messageId);
 }