Hi, I am currently developing a SAAS webapp using Tapestry 5.2.5. My goal is to make much of the functionality also available as a RESTful web service, using tapestry-resteasy, for additional clients such as iPhone apps to use. I would really like my tapestry web client to use the same API that I am making available to others, but I am having difficulty with the exact architecture.
Both the web client and the API will be served from the same tapestry webapp (at least initially), but this webapp will be installed on multiple servers. My prototype setup has the tapestry client pages interacting directly with the service classes behind the API, rather than calling the API through its RESTful interface. This has the advantage that it all happens on the same server, and I can avoid the latency involved with calls over the internet. I'd like to have my web client use the API as just another client, however I'm afraid that this means that the API calls will go over the internet and the application will become less responsive. What is the best practice for web services where the web client uses their own API? Is there a way of making sure that the call is routed to the same server that the client is using? Thanks David