From 34f38a81aedbcfe646bc95416ee4798efc1b54de Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 11 May 2022 22:32:23 +0200 Subject: [PATCH] getSingleUser --- .../java/com/covas/Resources/UsersRessources.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/covas/Resources/UsersRessources.java b/src/main/java/com/covas/Resources/UsersRessources.java index 097d96f..d41be90 100644 --- a/src/main/java/com/covas/Resources/UsersRessources.java +++ b/src/main/java/com/covas/Resources/UsersRessources.java @@ -1,29 +1,30 @@ package com.covas.Resources; -import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.covas.Entity.UsersEntity; +import org.jboss.logging.Logger; + -@Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Path("/api") +@Path("/api/users") public class UsersRessources { - + private static final Logger LOGGER = Logger.getLogger(UsersRessources.class); @GET - @Path("users") public Response getUsers(){ return Response.ok(UsersEntity.listAll()).build(); } @GET - @Path("user/{id}") - public Response getSingleUser(Long id){ + @Path("{id}") + public Response getSingleUser(@PathParam("id") Long id){ + LOGGER.info(id); UsersEntity users = UsersEntity.findById(id); if(users == null){ return Response.status(Response.Status.NOT_FOUND).build();