I am having trouble with this simple RestEasy service:
@Path("/")
public interface UserService {
@POST
@Path("/add")
@Consumes(MediaType.APPLICATION_JSON)
Response add(User user);
@POST
@Path("/update")
@Consumes(MediaType.APPLICATION_JSON)
Response update(User user);
@GET
@Path("/get/{id}")
@Produces(MediaType.APPLICATION_JSON)
Response get(@PathParam("id") long id);
@GET
@Path("/getAll")
@Produces(MediaType.APPLICATION_JSON)
Response getAll();
}
Basically, the above code works, however when I change the @Path("/") to @Path("/user") and access the resource like:
http://localhost:8080/user/add
it throws error 404. Unlike from the original http://localhost:8080/UserService/add that works.
Am I missing something in the code?
Maybe you could try
for @Path(/user)