Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.


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
How would one go about designing this?

share|improve this question
    
if you're using Spring you should check out Spring Data REST. There are some decisions made for you in that space, around the GET,PUT, DEL .. etc with some nice examples. –  Erik Nov 22 '13 at 16:28
    
sorry for the incredible late response, had a busy period. i did look into spring's solution and it provided some useful pointers for me to integrate in my application. @Erik thanks for the hint –  Radu Jan 7 at 12:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.