Webscripts in an Alfresco REST Architecture

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites & 3 Groups

    Webscripts in an Alfresco REST Architecture - Presentation Transcript

    1. Using Web Scripts in a REST-based Architecture Richard Im Solutions Engineer www.alfresco.com See the recorded webinar here: http:// snurl .com/ webscripts
    2. * 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
    3. 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
    4. 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
    5. 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
    6. 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
    7. 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
    8. 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
    9. 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
    10. // 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
    11. Alfresco Web Scripts cont... JSON ATOM HTML See the recorded webinar here: http:// snurl .com/ webscripts
    12. 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
    13. 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
    14. 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
    15. 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
    16. 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
    17. 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
    18. 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
    19. 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
    20. See the recorded webinar 03.04.08 See the recorded webinar here: http:// snurl .com/ webscripts

    + Alfresco SoftwareAlfresco Software, 2 years ago

    custom

    3910 views, 2 favs, 0 embeds more stats

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

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 3910
      • 3910 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 232
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories