JAX-RS @PathParam Example

You may also like...

Subscribe
Notify of
guest
1 Comment
Oldest
Newest
Inline Feedbacks
View all comments
Rampage Joe
Rampage Joe
January 16, 2018 11:07

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);

}

1
0
Would love your thoughts, please comment.x
()
x