I have implemented service layer which interacts with Data Access layer for data. So basically business logic is implemented at service layer. Services are implem开发者_C百科ented on spring framework. So basically each service can run on JBoss independently(as SAR). Now i want to implement presentation layer in smartGWT. So basically presenation layer code should call exposed methods of services for access of data. I want to know how well DataSource of smartGWT can integrate with a service and how to do same?
We did something similar. We put a Web layer on top of the Service layer. The Web layer contains Spring controllers that talk to SmartGWT (LGPL) RESTDataSources.
We've got it working nicely, but it's not a trivial task. The SmartGWT datasources are designed to integrate with the SmartGWT Pro libraries, which can make life tough if you're not using these. Make sure you understand the format of the requests/responses the datasources expect, see here:
SmartGWT RestDataSource
You'll probably find you have to customise the transformRequest() method on the datasource, see this question:
SmartGWT Datasource customization tutorial
We encountered a lot of problems with XPath support; basically it was fine for extracting data from complex objects sent to the datasource, but it was a nightmare trying to return complex objects in the correct format. We had to do a lot of work in transformRequest() to support this.
If you wish to use filtering, you will find yourself writing server code to interpret the Basic/Advanced Criteria objects SmartGWT sends.
You could also consider using Restlet, as mention in this question:
SmartGWT RestDataSource
In summary, you can do it and I encourage you to give it a go, but be prepared for a little work.
精彩评论