Book Image

Learning Alfresco Web Scripts

By : Ramesh Chauhan
Book Image

Learning Alfresco Web Scripts

By: Ramesh Chauhan

Overview of this book

Table of Contents (18 chapters)
Learning Alfresco Web Scripts
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Configuration document – it's optional


It is possible to specify configuration parameters for Alfresco web scripts. They can be accessed from the controller as well as the response template. Just to understand the concept, let's take a simple example where you want to display the server environment (development, testing, staging, or production server) in your web script output. One thing that you can do is specify the same in controller, but ideally, a controller should not worry about such configurations. Instead, this can be handled separately and the controller or template should just use the values. With the web script configuration document, it is possible to do script specific configuration.

Create helloworld.get.config.xml at the Repository | Data Dictionary | Web Scripts Extensions location and add the following content to it:

<properties>
  <envname>Dev</envname>
</properties>

Accessing configuration in a controller

In the JavaScript controller, the envname property...