Webscripts in an Alfresco REST Architecture
Upcoming SlideShare
Loading in...5
×
 

Webscripts in an Alfresco REST Architecture

on

  • 17,144 views

Full webinar with audio: http://tinyurl.com/6zdkjz ...

Full webinar with audio: http://tinyurl.com/6zdkjz

Alfresco Web scripts enable you to open up Alfresco, and make it accessible to other tools and applications.

This webinar is all about Web Scripts, and how they empower you to get the most out of Alfresco.

Statistics

Views

Total Views
17,144
Views on SlideShare
17,052
Embed Views
92

Actions

Likes
7
Downloads
670
Comments
0

2 Embeds 92

http://www.slideshare.net 91
http://translate.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Webscripts in an Alfresco REST Architecture Webscripts in an Alfresco REST Architecture Presentation Transcript

  • Using Web Scripts in a REST-based Architecture Richard Im Solutions Engineer www.alfresco.com See the recorded webinar here: http:// snurl .com/ webscripts
  • * What is REST? * What is a Web Script? * Common uses of Web Scripts * Review a Web Script for UI components * Review a Web Script for data retrieval * Sample. Agenda: See the recorded webinar here: http:// snurl .com/ webscripts
  • Acronym for: Representational State Transfer
    • An architectural style. Systems following these principles referred to as 'RESTful'
    • Resources are URL-Addressable. Easy utilizing HTTP Methods: GET, POST, PUT, DELETE.
    • “ REST strictly refers to a collection of network architecture principles which outline how resources are defined and addressed.
    • The term is often used in a looser sense to describe any simple interface which transmits domain-specific data over HTTP without an additional messaging layer such as SOAP or session tracking via HTTP cookies.”
    What is REST? See the recorded webinar here: http:// snurl .com/ webscripts
  • Key Rest Principles
    • Application state and functionality are abstracted into resources
    • Every resource is uniquely addressable using a universal syntax for use in hypermedia links
    • All resources share a uniform interface for the transfer of state between client and resource, consisting of
      • A constrained set of well-defined operations
      • A constrained set of content types, optionally supporting code on demand
    • A protocol which is: Client-server, Stateless, Cacheable, Layered
    The Principles of REST See the recorded webinar here: http:// snurl .com/ webscripts
  • REST v. SOAP WS
    • Cacheable representations, leading to improved response time.
    • Less dependencies: i.e. no SOAP
    • No need for a resource directory
    • More scalable. No session state maintenance required across servers.
    • Exchange of Resources, rather than Methods – Nouns v. Verbs
    REST Web Services See the recorded webinar here: http:// snurl .com/ webscripts
  • REST & Alfresco = Web Scripts
    • From 2.1 onward – ideally to open it up to more channels: Office, Portal, Websites
    • Ease of use and lightweight: Javascript, Templates
    • Multi use: create your own API, new UI components, widgets, expose features.
    • Cross language and cross platform data.
    • MVC – Alfresco Repository (Model), Javascript (Controller), Freemarker (View).
    Alfresco Web Scripts See the recorded webinar here: http:// snurl .com/ webscripts
  • Alfresco Web Scripts Web Script REST Dispatcher Web Script REST Infrastructure Content Services Rendition Services FreeMarker Repository Search Navigation Security HTML, ATOM, RSS, JSON URL JavaScript 2 3 5 4 6 1
    • Content
    • Metadata
    • User Interface Components
    • Queries
    See the recorded webinar here: http:// snurl .com/ webscripts
  • What makes a Web Script?
    • XML Descriptor file: define your resource
    • Javascript: Controller with access to various content services
      • Search: Search the repository and format the result any way needed.
      • Create: Add content into the repository.
      • Navigate: See what is in the repository
      • Security: Make sure you have the permissions to access
    • Freemarker: Representation/Response, format can be XML, JSON, HTML
    Alfresco Web Scripts cont... See the recorded webinar here: http:// snurl .com/ webscripts
  • XML Descriptor: docActions.get.desc.xml
    • XML Descriptor file: define your resource and HTTP method (naming convention)‏
    • url: Define your resource and any parameters needed to execute
    • Level of authentication required to run
    • Optionally define whether a transaction is required.
    • Can define a default format to fall back to incase format is not defined when executing.
    Alfresco Web Scripts Example <webscript> <shortname> Document Actions (Office Add-In) </shortname> <description> Used by the Office Add-In to perform actions on managed documents </description> <url> /office/docActions </url> <authentication> user </authentication> <transaction> required </transaction> </webscript> See the recorded webinar here: http:// snurl .com/ webscripts
  • // Client has requested server-side action /* Inputs */ var runAction = args.a; /* Outputs */ var resultString = &quot;Action failed&quot;, resultCode = false; // Is this action targetting a document? var docNodeId = args.n; if ((docNodeId != &quot;&quot;) && (docNodeId != null))‏ { var docNode = search.findNode(&quot;workspace://SpacesStore/&quot; + docNodeId); if (docNode != null && docNode.isDocument) { try { if (runAction == &quot;makepdf&quot;) { resultString = &quot;Could not convert document&quot;; var nodeTrans = docNode.transformDocument(&quot;application/pdf&quot;); if (nodeTrans != null) { resultString = &quot;Document converted&quot;; resultCode = true; } }... Javscript Controller: docActions.get.js Alfresco Web Scripts Example See the recorded webinar here: http:// snurl .com/ webscripts
  • Alfresco Web Scripts cont... JSON ATOM HTML See the recorded webinar here: http:// snurl .com/ webscripts
  • OK Great, now how do I apply this in a REST Architecture?
    • Can be applied in a DM or WCM Deployment, in similar fashion
    • Customize a completely different UI (i.e. Flex, HTML, Portal). (Web Scripts feature, not necessarily REST)‏
    • Use Alfresco in your own app without exposing them to Alfresco. You will get the performance and reliability of all Alfresco services but abstract it from the user's perspective. Data API
    • Serve content to users through Alfresco ASRs
    • Provide data to other services whether they're written in .NET, PHP, Java, etc.
    Web Scripts and REST Architecture See the recorded webinar here: http:// snurl .com/ webscripts
  • Office Plugin
    • Implemented in mini browser window
    • All actions available through REST API
      • HTML Response for UI
      • Other json for responses to update UI and data retrieval.
    • Core services accessible through plug-in
      • Doc management
      • Workflow
      • Search
    RESTful UI See the recorded webinar here: http:// snurl .com/ webscripts
  • Portlets/Gadgets
    • Allow users access through a portal like iGoogle.
    • Since Web Scripts are jsr-168 compliant, just have to make portal aware.
    • Popular portals: Jboss Portal, Liferay
    • All data transmitted through json, xml, html, through custom REST API
    RESTful UI See the recorded webinar here: http:// snurl .com/ webscripts
  • Sample DM Architecture
    • Client access Alfresco Web Scripts Directly
      • UI Web Scripts, Office Plugin Web Scripts, etc.
    • Or...Layer another application in between.
      • Webapp access Alfresco using RESTful API to retrieve data: XML, JSON, HTML
    • Can scale and cluster this environment
      • Your webapp
      • Alfresco ECM server
    RESTful DM Alfresco ECM Server Your Webapp See the recorded webinar here: http:// snurl .com/ webscripts
  • Sample Customer DM Architecture
    • Customer uses Alfresco as DAM
    • Manages all contents internally with Alfresco with custom UI and actions.
    • Same data then pushed out through transfer to serve internet
      • Webapp utilizes Web Scripts to get data from DMZ Alfresco
      • Able to perform transformations on images
      • Can download transformed or original.
    • Serves worldwide user base.
    RESTful DM Alfresco ECM Server Your Webapp Alfresco ECM Server See the recorded webinar here: http:// snurl .com/ webscripts Firewall
  • Sample WCM Architecture
    • Create your content on Alfresco WCM Server (Authoring)‏
    • Content (XML files, etc.) deployed to runtime
    • Web Scripts on the Alfresco Runtime serves your webapp:
      • Data Acess API
      • HTML, JSON, XML, RSS, ATOM, etc. Your choice
      • Supports cached results.
      • Use for searching, navigation, or dynamic page assembly.
    • Add more runtimes: load balance
    RESTful WCM Alfresco WCM Server Your Webapp Alfresco Runtime Alfresco Runtime Alfresco Runtime See the recorded webinar here: http:// snurl .com/ webscripts Firewall
  • Links
    • Alfresco Content Community Developer Toolbox: http://tinyurl.com/6yajvj
      • http://wiki.alfresco.com/wiki/RESTful_API
      • http://wiki.alfresco.com/wiki/RESTful_API_Reference
      • http://wiki.alfresco.com/wiki/Surf_Platform
      • http://wiki.alfresco.com/wiki/3.0_REST_API
    Useful Links See the recorded webinar here: http:// snurl .com/ webscripts
  • Q&A and Resources 03.04.08
    • Resources:
      • Developer Toolbox: http://tinyurl.com/6yajvj
      • RESTful API: wiki .alfresco.com/ wiki / RESTful _API
      • RESTful API Ref: wiki .alfresco.com/ wiki / RESTful _API_Reference
      • Alfresco SURF: wiki .alfresco.com/ wiki /Surf_Platform
      • Alfresco 3.0 REST API: wiki .alfresco.com/wiki/3.0_REST_API
      • Join the Content Community: alfresco.com/community/register
      • Developer Challenge: alfresco.com/partners/ programme / webscripts /
    • Join the Alfresco Facebook Group
      • facebook .com/group. php ? gid =6063383762
    • Nominate Alfresco in the Packt CMS Awards
      • http:// tinyurl .com/68og3p
    See the recorded webinar here: http:// snurl .com/ webscripts
  • See the recorded webinar 03.04.08 See the recorded webinar here: http:// snurl .com/ webscripts