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

Preface

The first thought that came to my mind when I got the opportunity to write this book was whether I will be able to take this up or not, as implementing web scripts in projects is completely different from writing a book on it. However, at the same time, I was curious and excited as well to write my first book. What I always believe is—if you think you can do it, then just go for it and give your best try to achieve it. Hence, I took this opportunity and started my new journey of writing my first book to share my knowledge, learning, and experience with you.

To give you a brief account of the book, web scripts is one of the key features of Alfresco and is a must know for each and every developer working on Alfresco. It is really essential for a developer working on Alfresco to be familiar with the powerful web script framework and understand how to practically implement web scripts. In this book, you will get to learn all the basic details required to work with web scripts in Alfresco and get yourself competent with web script development for your projects to implement useful integration solutions with Alfresco.

A few years back, I was also a beginner. Now, I have vast experience of using web scripts in different real-time business implementations. Based on my learning and experience from my journey as a beginner to my current level of expertise in regards to implementing web scripts, I have tried to provide the most useful information that will help a lot to new or experienced developers who are looking forward to exploring and learning about web scripts.

I have attempted to share the knowledge and learning that I have gained throughout my experience working on Alfresco web scripts. I have tried to explain the key concepts about web scripts in a simple way and have used practical examples to understand how to implement web scripts. I have also gone deep into technical details where I felt it would be required to help you learn about the web script framework in a better way.

By the end of this book, you will be able to say that you are familiar with web scripts and are ready to take up new assignments to develop custom web scripts as you have gained the required knowledge to practically implement them in Alfresco. You will also be able to debug, troubleshoot, and fix the issues that you might come across while working on web scripts. Also, you will be able to share the core technical knowledge about the powerful web script framework with your colleagues.

My journey of writing this book has reached its destination as the book is now available in your hand. Now, you are about to begin your journey of reading this book and learning about Alfresco web scripts. Hope you have a wonderful journey ahead!

What this book covers

Chapter 1, Getting Familiar with Web Scripts, introduces you to web scripts by exploring answers to some of the basic questions about web scripts, which will give you a clear idea about how web scripts can be useful for implementing integration solutions with Alfresco.

Chapter 2, It's Time for the First Web Script, walks you through implementing your first web script in Alfresco, which will give you the knowledge required about the core fundamentals along with some key points to take care of when practically implementing web scripts in your projects.

Chapter 3, Understanding the Web Script Framework, covers the powerful web script framework, which will make you well acquainted with the detailed technical knowledge of web script execution and the backbone pillars of the web script framework.

Chapter 4, Building Blocks of Web Scripts, provides you complete details about all the components to build web scripts.

Chapter 5, Invoking Web Scripts, describes the various ways you can execute a web script that will help you to choose the way to execute web scripts as required.

Chapter 6, Creating Java-backed Web Scripts, helps you understand how to practically implement Java-backed web scripts through the implementation of a sample use case.

Chapter 7, Understanding JavaScript-based Web Scripts in Detail, explains what you can do with JavaScript APIs in Alfresco web scripts and makes you aware about the different root objects to access these APIs and useful root objects exposed by the web script framework. It also takes you through some code examples for some of the common functionalities in JavaScript-based web scripts.

Chapter 8, Deployment, Debugging, and Troubleshooting Web Scripts, guides you through the options to deploy web scripts in detail and also walks you through some useful debugging techniques and troubleshooting pointers along with some important points to execute web scripts in a production environment.

Chapter 9, Mavenizing Web Scripts, gives you basic knowledge of setting up the development environment in Eclipse using the Alfresco Maven SDK to develop web scripts.

Chapter 10, Extending the Web Script Framework, familiarizes you with the possibility of extending the core components of the web script framework in Alfresco to help you understand the power of working in an open source technology.

What you need for this book

You will need to have a working instance of Alfresco that will help you throughout the journey of this book. You should use Alfresco Version 4.2 and above.

Who this book is for

If you are a new Alfresco developer and are exploring web scripts in Alfresco, then this book is for you. This book will help you gain the key basic knowledge required to implement web scripts in Alfresco. If you are an experienced developer in Alfresco and are familiar with the basics of web script development but have not yet fully explored the web script framework, then this book is for you as it will help you gain the required knowledge about it. If you have already explored web scripts in Alfresco and have gained a very good understanding about it, then you will find this book useful as a quick and handy reference.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "DeclarativeWebScript sets the response to be rendered."

A block of code is set as follows:

private RestTemplate restTemplate;
public void setRestTemplate(RestTemplate restTemplate) {
  this.restTemplate = restTemplate;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<html>
  <body>
    <p>Hello! ${args.name}.</p>
  </body>
</html>

Any command-line input or output is written as follows:

curl -u admin:admin "http://localhost:8080/alfresco/service/helloworld?name=Ramesh"

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on the List Web Scripts link."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.