getSingleUser
This commit is contained in:
parent
0adf2a3e31
commit
34f38a81ae
@ -1,29 +1,30 @@
|
|||||||
package com.covas.Resources;
|
package com.covas.Resources;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import com.covas.Entity.UsersEntity;
|
import com.covas.Entity.UsersEntity;
|
||||||
|
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("/api")
|
@Path("/api/users")
|
||||||
public class UsersRessources {
|
public class UsersRessources {
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(UsersRessources.class);
|
||||||
@GET
|
@GET
|
||||||
@Path("users")
|
|
||||||
public Response getUsers(){
|
public Response getUsers(){
|
||||||
return Response.ok(UsersEntity.listAll()).build();
|
return Response.ok(UsersEntity.listAll()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("user/{id}")
|
@Path("{id}")
|
||||||
public Response getSingleUser(Long id){
|
public Response getSingleUser(@PathParam("id") Long id){
|
||||||
|
LOGGER.info(id);
|
||||||
UsersEntity users = UsersEntity.findById(id);
|
UsersEntity users = UsersEntity.findById(id);
|
||||||
if(users == null){
|
if(users == null){
|
||||||
return Response.status(Response.Status.NOT_FOUND).build();
|
return Response.status(Response.Status.NOT_FOUND).build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user