What's new in Alfresco 3 web scripts

Alfresco has introduced web scripts framework in older versions such as 2.1. With new releases of Alfresco, efforts are being made to enhance the capabilities of web scripts. Following are some of the enhancements for web scripts available from Alfresco 3 onwards:

  • Standalone component

    With this new Alfresco version 3, the web script architecture is refactored in such a way that you need not use the Alfresco repository server to host, but you can host it in any environment and even in tiers. This will allow web scripts to be used in a presentation layer to render UI. For example, the Alfresco Surf platform hosts the web script framework for reusable UI components.

  • URI templates comply with JSR-311 (JAX-RS)

    A URI template is simply a URI containing tokens that may be substituted with actual values. From Alfresco 3.0, this template syntax complies with the template syntax of JSR-311 (JAX-RS).

  • Run as user

    You can use the runas attribute with authentication in the description document for a web script. This will allow declaring an alternative username to run the web script, as this is valid for class path-stored web scripts only.

  • Ability to customize web scripts with web script-specific configuration

    Configuration is accessed via the config root object, which is available during both controller script and template execution. So, with the help of this, you can have web script-specific configuration, which can then be used in a controller or rendering template.

  • Per web script message bundle

    To localize the web script response, with Alfresco 3.0 and later, you can have a message bundle for each web script.

  • Improved form processing

    When posting a request of mime type multipart/form-data, formdata is available to the controller script as a root object. This root object allows a web script to read all fields. These multi-part form fields are also mapped to args/argsM.

  • Access to request headers

    With this version, Alfresco provides one more JavaScript root object named headers, which is an associative array of all request headers. In this way, you can access the request header as well from the web script controller script.

  • Request body processing

    The root object requestbody, which represents the content of a request body, is available with Alfresco 3.

  • Content negotiation

    You can have a negotiate element in a description document, which associates an Accept header mime type to a specific web script format of response; the value (mandatory) specifies the format while the accept attribute (mandatory) specifies the mime type. You can have zero or more negotiation elements, but to enable content negotiation you need the definition of at least one negotiate element.

  • Declarative and programmatic cache control

    You can have a cache element specified in the description document (declarative) for caching and set some child elements to configure the cache. Also, you can have a cache root object available in the controller, which helps to control the cache runtime (programmatic).

    You can override some definition time controls and also set expiry criteria with this root level object cache.

  • Web script families

    If you want to categorize similar or related web scripts in groups, you can configure a family element in the description document.

    The family tag may be repeated if the script belongs to more than one family.

  • Specialized kinds of web scripts

    A web script "kind" allows a Java-backed implementation to be named, and for any web script description document to state if it wants to use that implementation instead of the out-of-the-box one provided by Alfresco.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset