Almost all web content can be a resource to be served up on its own. Web front-ends, however, mix unconnected resource content in order to serve the user with some desired experience. A blog page might be laid out with its articles stacked on the left and a list of the site's other popular blogs on the right, as an example. Let's say the web service for both of those resource lists are at uris: /blogs/{blogname}/entries and /popularblogs, respectively.
I'm using Spring's REST implementation and can infer return content-types. So, when a request for html comes in, I could return a nice little facade to present the underlying atom lists for each of those examples. However, I still need to serve the web ui page that displays the left-right composite presentation from some where.
From what URI does the web user access that page?
I figure there are 2 options:
I could have a 3rd uri for web ui pages, maybe splitting the uri tree into 2 roots, like /rest/** for restful web services (which would house web services for both lists in the example) and /web/** for web ui service (which would know to serve up the composite page at some uri and ajax call over to the /rest/** world for content as needed).
Or, I could return the composite web ui page from each of the blog-entries and popular-blogs rest requests when return content-type of html is inferred.
What is the best practice?
Any feedback is very, very much appreciated. Thank you! Thank you!