Summary
This chapter gave you an introduction to the Alfresco Web Script Framework. You began with a very simple Hello World script and then gradually moved to more complex examples culminating in a REST API for retrieving whitepapers, getting the average rating for a specific whitepaper, posting new ratings for a given whitepaper, and deleting all ratings for a specific whitepaper.
The SomeCo website was able to leverage the web scripts to add a whitepaper list along with a graphical ratings widget. The widget, the web scripts, and the backend model are generic enough to be used for other types of content as well.
Other takeaways from this chapter include the following:
- Web scripts are mainly composed of an XML descriptor, one or more FreeMarker templates (one for each response format), and, optionally, a controller.
- Controllers can be implemented as JavaScript or Java, and have full access to the Alfresco API. Controllers share data with the view via the model, which is essentially a HashMap...