JAX-RS @PathParam Example

You may also like...

Leave a Reply

1 Comment on "JAX-RS @PathParam Example"

avatar
  Subscribe  
newest oldest
Notify of
Rampage Joe
Guest
Rampage Joe

HI

i have a book class with two filed, genre and author, and i want the application to list all the books on genre or author below is my code for RestAPi

@GET

@Produces({“application/xml”})

@Consumes({“application/xml”})

@Path(“{genre}”)

public List Find_Book_By_Genre(@PathParam(“genre”) String genre)

{

return bcontl.getBookByGenre(genre);

}

@GET

@Produces({“application/xml”})

@Consumes({“application/xml”})

@Path(“{author}”)

public List getBookByAuthor(@PathParam(“author”) String author, @Context HttpHeaders headers)

{

return bcontl.getBookByAuthor(author);

}