Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhirockzz/9dd8773d21cc34ec6eaf to your computer and use it in GitHub Desktop.
Save abhirockzz/9dd8773d21cc34ec6eaf to your computer and use it in GitHub Desktop.
A hypothetical resource of books
@Path("books")
public class Books{
@Produces("application/json")
@GET
public List<Book> findAll(){
//find all books
}
@Produces("application/json")
@GET
@Path("{id}")
public Book findById(@PathParam("id") String bookId){
//find book by id e.g. /books/123
}
@Produces("application/json")
@GET
public Book findByISBN(@QueryParam("isbn") String bookISBN){
//find book by ISBN e.g. /books?isbn=xyz
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment