Book Image

Alfresco Developer Guide

Book Image

Alfresco Developer Guide

Overview of this book

Table of Contents (17 chapters)
Alfresco Developer Guide
Credits
About the Author
About the Reviewers
Preface
Index

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 web site was able to leverage the web scripts to add a Whitepaper listing 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:

  • Web scripts are 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.

  • The URL structure...