Skip to content

Instantly share code, notes, and snippets.

@recursivecodes
Created July 1, 2019 14:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save recursivecodes/e67492d2f99b13f7d56dd5a61cabeb3e to your computer and use it in GitHub Desktop.
UserResource.java
@Path("/{id}")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getById(@PathParam("id") String id) {
    User user = userRepository.get(id);
    if( user != null ) {
        return Response.ok(user).build();
    }
    else {
        return Response.status(404).build();
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment