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

Retrieving Data with Web Scripts


The first service that needs to be implemented retrieves the list of Whitepapers enabled for publication. The web script needs to return the list of Whitepapers in two formats: HTML and JSON. HTML will allow you to easily test the service and JSON will make it easy for code on the frontend to process the list. This will require four files: one descriptor, one JavaScript controller, and two FreeMarker templates—one for each format.

Note

New to JSON? It stands for JavaScript Object Notation. It is a way to describe JavaScript objects in plain text. The beauty of it is that it is extremely easy to create and consume, and it isn't as verbose as XML. For more information on JSON, see http://www.json.org.

Step-by-Step: Writing a Web Script to List Whitepapers

To create a web script that retrieves the list of Whitepapers, do the following:

  1. First, in your Eclipse project create the descriptor file in |config|alfresco|extension|templates|com|someco|whitepapers. Name it...