Nuxeo WebEngine: a practical introduction
-
Upload
nuxeo -
Category
Technology
-
view
3.160 -
download
6
description
Transcript of Nuxeo WebEngine: a practical introduction
Nuxeo WebEngineNuxeo WebEnginea practical introductiona practical introduction
Bogdan Stefanescu |
Overview
● What is WebEngine?● Architecture
● JAX-RS● Object Model● Scripting● Templates
Overview
● Examples● Creating a JAX-RS resource● Creating a Web Module● Working with Web Objects● Working with Web Adapters● Managing Links● Internationalization
WebEngine – What Is?
A framework to build RESTful Web Applications on top of the Nuxeo Platform. Goals:● Rapid development of Web Applications: intuitive
and extensible model, scripting, fast startup time, hot reload etc.
● An unique platform to develop all kind of content oriented Web Applications including – Content oriented Web sites.– REST services for Nuxeo Platform.– Rich front ends based on AJAX frameworks like GWT.
● Pleasant coding experience● Light packaging
WebEngine - Features
● Powerful Object Model built on top of JAX-RS.● Full Groovy Scripting support.● Powerful template engine based on Freemarker● Content Management through Nuxeo Platform● Packaged in several flavors:
● Standalone server with GlassFish v3 embedded● Standalone server with Jetty embedded● Tomcat Web Application● Nuxeo EP plug-ins
Architecture - JAX-RS
● WebEngine model is based on JAX-RS standard.
● JAX-RS is a Java API to build RESTful Web Services.
● JAX-RS is exposing Java objects as Web resources. Binging objects to Web resources is done by using Java annotations.
● HTTP requests will be resolved to JAX-RS resources that will be manipulated using common HTTP methods like GET, POST, PUT, DELETE, HEAD.
Architecture – Object Model
● Why an Object Model on top of JAX-RS?● Provides a coherent model to build modular
applications.● An Web Application is deployed as an Web Module.● Web Modules can extend other Web Modules.● Web Modules are bound to a fixed Web path and
provides access to Web Resources defined inside the module or in extended modules.
● Web Resources are extensible and can be shared between modules.
Architecture – Object Model
● Why an Object Model on top of JAX-RS?● Provides a coherent model to expose Java
Objects as Web Resources.● Web Module Entry Point – the root resource that is
the entry point for any request on the module. It is explicitly bound to a Web path using @Path annotation.
● Web Objects – sub-resources that are exposing concrete functionality.
● Web Adapters – sub-resources that enable to easily extends existing Web Objects.
Architecture – Web Modules
● An Web Module is defining:● Web Resources and templates to expose.● Static and i18n resources (CSS, PNG etc)● An Web Path under which the module
resources can be found● A JAX-RS root resource – which will usually
dispatch any request to sub-resources like Web Objects and Web Adapters
● Inherited Web Modules
Architecture – Web Objects
● Web Objects are JAX-RS resources that expose concrete objects to the Web.
● Web Objects have a type and a set of optional facets.
● Web Object types can be derived to create new types that inherit behaviors from the super type.
● Facets describes the Web Object behaviors.● Web Objects may define views using template
files.
Architecture – Web Adapters
● Web Adapters are JAX-RS resources that can be used to expose additional functionalities on existing Web Objects.
● Is a specialized Web Object and have a type and optional facets like any other Web Object.
● Can be restricted to adapt only specific Web Objects by using filters based on target Web Object type and facets.
● Are invoked using a @ prefix● Example: GET /my/doc/@versions
Architecture – Documents
● WebEngine is providing built-in support to expose Nuxeo Documents as Web Objects.
● Document Types are mapped to Web Objects by respecting the document type hierarchy.● Provides a generic Document Object that will catch
any document type which is not explicitly exposed.
● Document types and facets are transparently mapped as Web Object type and facets.
● Several Web Adapters are provided: Versioning Adapter, Lock Adapter, Relations Adapter etc.
Architecture – Scripting
● Built-in Groovy scripting.● Any Web Resource can be defined as a Groovy
object.● Java and Groovy share the same Class Path.
● One can build mixed Web Modules with both Groovy and Java objects.
● A Groovy object may call or extend any Java object and vice-versa.
● Hot reload of Groovy classes in debug mode.
Architecture - Templates
● The template engine is building client responses using template files.
● Based on Freemarker engine.● Custom extensions to add dynamic blocks, Wiki
rendering etc.● Dynamic Blocks are used to create extensible
templates.● Templates that define dynamic blocks may e
extended by other templates that may redefine any block.
Examples – JAX-RS
Examples – Web Module
Examples – Web Object
Examples – Web Adapter
Examples – Templates
Examples – Links
Examples – Internationalization
Thank you!Thank you!