1

I want to implement REST calls in a web application. I took a look at the different available frameworks to achieve that. It seems JBoss Resteasy provides what I need:

@GET
    @Path("book/{id}/comments")
    public Collection<Comment> getComments(@PathParam("id") String bookId);

What I would like would be something like:

@GET
    @Path("book/{id}/comments")
    public Collection<Comment> getComments(@PathParam("id") **Book** bookId);

So instead of receiving a String I would be interested in binding directly the value. Meaning if my Book extends a AbstractEntity class, it would directly do the findById in the database.

I used to achieve this with Spring MVC by using Custom Conversion Services that would do the findById directly. Is there such functionality in RestEasy, or any other REST framework?

Thanks!

Grolubao
  • 94
  • 1
  • 5

1 Answers1

1

I've not done this, but RESTEasy has a StringConverter interface that might accomplish this. Check out Chapter 24 in the RESTEasy documentation: http://docs.jboss.org/resteasy/docs/2.3.1.GA/userguide/html/StringConverter.html

Jeremiah Orr
  • 2,620
  • 1
  • 18
  • 24