JAX-RS @PathParam Example

You may also like...

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Rampage Joe Recent comment authors
  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);

}