I'm builiding a web app and I'm implementing a RESTful API to expose the server to all sort of clients.
In order to serve the HTML from the server I need to consume the REST API, so I was thinking on putting the logic on servlets which will interact with the REST API and then print the result using JSP.
What I would like to know is:
- What is the best way to do consume the REST services in the servlets? I mean they are on the same server so should I still implement a REST client on the servlets?
- Won't that create too many http requests? Client -> Servlet -> REST API, isn't there a way to do it in a more direct way?