I am working on a project and would like to expose some REST services. The technologies used are RestEasy, EJB and JPA/Hibernate. I have structured my app so that there is a clear delimitation between the service layer and model layer. A typical service that retrieves data from the database have a signature like this:
getWhateverList(idForWhichTheListWillBeRetrieved, start) - so pretty basic.
What I'm having a hard time wrapping my head around is how to bring together the stiffness of the service layer with the flexibility of the REST layer. Say for example that I would like a typical GET method producing a JSON array support operations like:
- filtering - use a query param to get, for example items that have a property of type date greater/lower than the param that I provide
- sorting - REST API should support asc or desc
- limiting the fields that are returned from the GET operation