You are here

Web script controller script

A web script controller script is a JavaScript file that contains the actual logic of a web script.

The controller script can query the Alfresco content repository to build a set of data items, known as a model, to render in the response. It might also update the Alfresco repository for URIs that intend to modify the repository (PUT, POST, and DELETE method bindings). The JavaScript has access to the URI query string, Alfresco content application services, and content repository data entry points.

// check that search term has been provided
if (args.q == undefined || args.q.length == 0)
   status.code = 400;
   status.message = "Search term has not been provided.";
   status.redirect = true;
   // perform search
   var nodes = search.luceneSearch("TEXT:" + args.q);
   model.resultset = nodes;