SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
EXPath Webapp
CXAN: a case-study for Servlex,
   an XML web framework


                           th
 XML Prague, March 26 , 2011



        Florent Georges
          H2O Consulting
EXPath Webapp

●
    Introduction              ←
●   Webapp, the module
●   Data-driven
●   Servlex
●   The CXAN website
●   From scratch
●   Conclusion
The EXPath Universe
Introduction - Packaging

●   A specification to package libraries
●   Supported by several processors
        –   eXist
        –   Qizx
        –   Saxon (as 3d party impl)
        –   Calabash (as 3d party impl)
●   A package is a standalone file...
●   ... a ZIP file with components and a descriptor
Introduction - CXAN

●   Same idea as CTAN for TeX/LaTeX, or CPAN
    for Perl, or APT for Debian
●   A central, comprehensive, organized collection
    of packages:
       –   Libraries (XSLT, XQuery, XProc, schemas, …)
       –   Applications (command line, webapps, …)
●   Maintained on a central website
●   Accessible through a browser
●   Accessible through the CXAN client
Introduction - Webapp

●   Define a web container to deploy webapps
●   A webapp is a set of components (in XSLT,
    XQuery or XProc)
●   It has a descriptor to map incoming URIs to
    specific components
●   It is packaged using the Packaging System
●   A webapp is able to do whatever is possible to
    do with HTTP on server-side
●   That is, it is able to build your website
Introduction - Samples

●   An existing implementation of EXPath Webapp
    is Servlex
●   Some existing websites deployed on Servlex:
        –   http://expath.org/
        –   http://h2oconsulting.be/
        –   and... http://cxan.org/
●   Of interest:
        –   http://h2oconsulting.be/xqts/
        –   http://h2oconsulting.be/tools/dump
EXPath Webapp

●   Introduction
●
    Webapp, the module        ←
●   Data-driven
●   Servlex
●   The CXAN website
●   From scratch
●   Conclusion
Webapp - Goal
●   The final, user-level goal is to be able to
    respond to any HTTP request on the server
    (so implementing websites, web services, etc.)
●   Webapp is aimed at defining a processor-
    agnostic web container for XML technologies
●   The web container allows one to deploy web
    applications written directly in XSLT, XQuery
    and/or XProc
●   A webapp is interoperable as long as it
    respects the rules in the Webapp spec
Webapp - Components
●   Components are either:
       –   XProc step
       –   XProc pipeline
       –   XQuery function
       –   XQuery main module
       –   XSLT function
       –   XSLT named template
       –   XSLT stylesheet
Webapp - At 10,000 feet

●   The Webapp Module defines a web container
    responding to HTTP requests
●   The processing is defined by user applications
Webapp - Overall processing
●   Under the hood, the URI of each HTTP
    request is inspected
●   It is used to choose an application to serve it
●   It is then used to pick a component within the
    application, using its own map
●   The component is evaluated with an XML
    representation of the HTTP request
●   The component result is an XML rep of the
    HTTP response to send back
Webapp - 1:1 scale
Webapp – The request
●   Represent the HTTP request in XML
●   Easy access to specific pieces using XPath
Webapp – The response
●   Represent the HTTP response in XML
●   Returned by the component called with the
    request element
Webapp – The dispatcher
●   Based on the web descriptor
●   It maps URI to components, using regexs
Webapp – The dispatcher
Webapp - Filters & Co.

●   The dispatcher can perform more complex
    processing
●   According to the map, it can setup filters, error
    handlers, chain them, and order them
●   Error handlers help setting a consistent error
    reporting mechanism
●   Filters can apply a consistent layout, inject
    data, handle authentication, or build a
    dedicated data model for the application
Webapp - Packaging

●   Webapp defines how to package a webapp
●   It builds on the EXPath Packaging System
●   Basically, a webapp file is a standard package
    with a web descriptor, expath-web.xml
●   Standard packaging tools can be used for web
    applications
●   A webapp itself can be published on CXAN,
    thus retrieved and installed automatically in a
    web container's repository
EXPath Webapp

●   Introduction
●   Webapp, the module
●
    Data-driven               ←
●   Servlex
●   The CXAN website
●   From scratch
●   Conclusion
Data - What's different?

●   The framework is data-oriented, in particular
    the web:request and web:response elements
●   What is different? Nothing, one could argue
●   But in the developer's eyes
        –   More clear, easier to learn
        –   Easier to log, and to investigate bug reports
●   Easy to create:
        –   A custom data layer dedicated to the app
        –   Filters transforming inputs & outputs
Data - Testability

●   The web:request and web:response elements
    are the interface between the application
    components and the web container
●   Because they are data, it is easy to create
    them by hand or generate them, and to save
    them on disk and in a revision control system
●   Even at the highest level, no need of plenty of
    dedicated functional test tools to simulate the
    behavior of the web container, a web:request
    element describes a complete HTTP request
Data - Testability, say it again



A webapp is unit-testable all along the way,
up to the very top of the stack
EXPath Webapp

●   Introduction
●   Webapp, the module
●   Data-driven
●
    Servlex                   ←
●   The CXAN website
●   From scratch
●   Conclusion
Servlex - Intro

●   Servlex in one implementation of the web
    container defined in the Webapp Module
●   It is open-source
●   It is available at http://servlex.googlecode.com/
●   It is written in Java
●   On the network hand, it uses Java Servlet
    technology, for the link to HTTP
●   On the XML hand, it uses Saxon and Calabash,
    as its XSLT, XQuery and XProc processors
Servlex - Install

●   Servlex is a standard WAR file
●   It can be deployed in Tomcat, Jetty, Glassfish,
    but also in Google Appengine and Amazon
    Cloud EC2 (you know, that cloud thing)
●   The only config is to point to a standard on-
    disk package repository (by setting a Java
    system property)
●   It contains a admin interface to manage and
    install web applications and packages
Servlex - Manager
Servlex - Google Appengine

●   Google Appengine does not allow disk access
●   The repository is all in the classpath
●   The set of webapps is therefore fixed in the
    Servlex instance deployed on Appengine
●   http://fgeorges.appspot.com/expath/ as an
    example
●   Could be deployed in other cloud systems
EXPath Webapp

●   Introduction
●   Webapp, the module
●   Data-driven
●   Servlex
●
    The CXAN website          ←
●   From scratch
●   Conclusion
CXAN - The website

●   The central part of CXAN is its website
●   It can be browsed as a website or used via its
    well-defined REST-like API
●   There is a command-line client, but there can
    be several of them, e.g. in an XML database
●   It stores packages (XAR files + distributions)
●   It organizes them by name, and by using tags,
    categories, and authors, as well as a CXAN ID
●   A package stores additional infos in cxan.xml
CXAN - Architecture
CXAN - Architecture

●   One component for each page (in XProc)
●   There is a global error handler, catching XPath
    errors, returning a user-friendly error page
●   The components return a page document
●   There is a global output filter, transforming
    page documents into full HTML pages, with
    consistent layout
●   Based on the HTTP Accept header, they can
    return XML instead (for REST-style calls)
EXPath Webapp

●   Introduction
●   Webapp, the module
●   Data-driven
●   Servlex
●   The CXAN website
●
    From scratch              ←
●   Conclusion
From scratch - Old school

●   A webapp is a standard package
●   So it is a ZIP file, with a particular structure
●   So it must contain a package descriptor
●   The package descriptor identifies components
    (by assigning them public import URIs)
●   It contains a web descriptor (expath-web.xml),
    linking request URIs patterns to components
From scratch - New age

●   Maintaining the package descriptor separately
    from the components is painful
●   So is creating the ZIP file
●   A standard tool, based on some project infos,
    annotations in the components and a project
    structure, builds the package descriptor and
    the ZIP file
●   We have to write the web descriptor, be we
    could improve the tool to use annotations
From scratch - Project structure
EXPath Webapp

●   Introduction
●   Webapp, the module
●   Data-driven
●   Servlex
●   The CXAN website
●   From scratch
●
    Conclusion                ←
EXPath Universe - Once again
●   Join the mailing list and install Servlex:
          http://expath.org/
          http://servlex.googlecode.com/
EXPath Webapp - CXAN: a case-study for Servlex, an XML web framework

Mais conteúdo relacionado

Mais procurados

Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaJerry Kuru
 
Apache james more than emails in the cloud
Apache james  more than emails in the cloudApache james  more than emails in the cloud
Apache james more than emails in the cloudIoan Eugen Stan
 
An Introduction to Akka http
An Introduction to Akka httpAn Introduction to Akka http
An Introduction to Akka httpKnoldus Inc.
 
(ATS6-DEV06) Using Packages for Protocol, Component, and Application Delivery
(ATS6-DEV06) Using Packages for Protocol, Component, and Application Delivery(ATS6-DEV06) Using Packages for Protocol, Component, and Application Delivery
(ATS6-DEV06) Using Packages for Protocol, Component, and Application DeliveryBIOVIA
 
(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collectionsBIOVIA
 
HBaseConEast2016: Coprocessors – Uses, Abuses and Solutions
HBaseConEast2016: Coprocessors – Uses, Abuses and SolutionsHBaseConEast2016: Coprocessors – Uses, Abuses and Solutions
HBaseConEast2016: Coprocessors – Uses, Abuses and SolutionsMichael Stack
 
Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Artefactual Systems - Archivematica
 
Display earthquakes with Akka-http
Display earthquakes with Akka-httpDisplay earthquakes with Akka-http
Display earthquakes with Akka-httpPierangelo Cecchetto
 
Load testing in Zonky with Gatling
Load testing in Zonky with GatlingLoad testing in Zonky with Gatling
Load testing in Zonky with GatlingPetr Vlček
 
Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1PgTraining
 
Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009fschupp
 
Enterprise(d) Tomcat & httpd
Enterprise(d) Tomcat & httpdEnterprise(d) Tomcat & httpd
Enterprise(d) Tomcat & httpdVaclav Tunka
 
Event sourcing Live 2021: Streaming App Changes to Event Store
Event sourcing Live 2021: Streaming App Changes to Event StoreEvent sourcing Live 2021: Streaming App Changes to Event Store
Event sourcing Live 2021: Streaming App Changes to Event StoreShivji Kumar Jha
 
HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...
HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...
HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...Michael Stack
 
What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?Nuxeo
 
The history of Prometheus at SoundCloud
The history of Prometheus at SoundCloudThe history of Prometheus at SoundCloud
The history of Prometheus at SoundCloudTobias Schmidt
 

Mais procurados (20)

Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with Scala
 
Apache james more than emails in the cloud
Apache james  more than emails in the cloudApache james  more than emails in the cloud
Apache james more than emails in the cloud
 
An Introduction to Akka http
An Introduction to Akka httpAn Introduction to Akka http
An Introduction to Akka http
 
Java one2013
Java one2013Java one2013
Java one2013
 
(ATS6-DEV06) Using Packages for Protocol, Component, and Application Delivery
(ATS6-DEV06) Using Packages for Protocol, Component, and Application Delivery(ATS6-DEV06) Using Packages for Protocol, Component, and Application Delivery
(ATS6-DEV06) Using Packages for Protocol, Component, and Application Delivery
 
Apache James/Hupa & GWT
Apache James/Hupa & GWTApache James/Hupa & GWT
Apache James/Hupa & GWT
 
(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections
 
HBaseConEast2016: Coprocessors – Uses, Abuses and Solutions
HBaseConEast2016: Coprocessors – Uses, Abuses and SolutionsHBaseConEast2016: Coprocessors – Uses, Abuses and Solutions
HBaseConEast2016: Coprocessors – Uses, Abuses and Solutions
 
Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)Archivematica Technical Training Diagnostics Guide (September 2018)
Archivematica Technical Training Diagnostics Guide (September 2018)
 
Introduction to the Archivematica API (September 2018)
Introduction to the Archivematica API (September 2018)Introduction to the Archivematica API (September 2018)
Introduction to the Archivematica API (September 2018)
 
Display earthquakes with Akka-http
Display earthquakes with Akka-httpDisplay earthquakes with Akka-http
Display earthquakes with Akka-http
 
Automation tools: making things go... (March 2019)
Automation tools: making things go... (March 2019)Automation tools: making things go... (March 2019)
Automation tools: making things go... (March 2019)
 
Load testing in Zonky with Gatling
Load testing in Zonky with GatlingLoad testing in Zonky with Gatling
Load testing in Zonky with Gatling
 
Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1Oracle to Postgres Migration - part 1
Oracle to Postgres Migration - part 1
 
Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009
 
Enterprise(d) Tomcat & httpd
Enterprise(d) Tomcat & httpdEnterprise(d) Tomcat & httpd
Enterprise(d) Tomcat & httpd
 
Event sourcing Live 2021: Streaming App Changes to Event Store
Event sourcing Live 2021: Streaming App Changes to Event StoreEvent sourcing Live 2021: Streaming App Changes to Event Store
Event sourcing Live 2021: Streaming App Changes to Event Store
 
HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...
HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...
HBaseConEast2016: How yarn timeline service v.2 unlocks 360 degree platform i...
 
What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?What’s new in Nuxeo 5.2?
What’s new in Nuxeo 5.2?
 
The history of Prometheus at SoundCloud
The history of Prometheus at SoundCloudThe history of Prometheus at SoundCloud
The history of Prometheus at SoundCloud
 

Destaque (9)

De Veloceraptor
De VeloceraptorDe Veloceraptor
De Veloceraptor
 
Puzzle Gigante
Puzzle GigantePuzzle Gigante
Puzzle Gigante
 
La narrazione in atto incroci e idee tra gioco e storie leggendo e inventanto...
La narrazione in atto incroci e idee tra gioco e storie leggendo e inventanto...La narrazione in atto incroci e idee tra gioco e storie leggendo e inventanto...
La narrazione in atto incroci e idee tra gioco e storie leggendo e inventanto...
 
EXPath: the packaging system and the webapp framework
EXPath: the packaging system and the webapp frameworkEXPath: the packaging system and the webapp framework
EXPath: the packaging system and the webapp framework
 
De Stegosaurus
De StegosaurusDe Stegosaurus
De Stegosaurus
 
Quanti libri in un libro di Paola Romagnoli
Quanti libri in un libro di Paola RomagnoliQuanti libri in un libro di Paola Romagnoli
Quanti libri in un libro di Paola Romagnoli
 
De Brachiosaurus
De BrachiosaurusDe Brachiosaurus
De Brachiosaurus
 
I gruppi di lettura come esperienza di salute e benessere di Roberto Spoldi
I gruppi di lettura come esperienza di salute e benessere   di Roberto SpoldiI gruppi di lettura come esperienza di salute e benessere   di Roberto Spoldi
I gruppi di lettura come esperienza di salute e benessere di Roberto Spoldi
 
Balisage - EXPath Packaging
Balisage - EXPath PackagingBalisage - EXPath Packaging
Balisage - EXPath Packaging
 

Semelhante a EXPath Webapp - CXAN: a case-study for Servlex, an XML web framework

Galaxy
GalaxyGalaxy
Galaxybosc
 
Balisage - EXPath - A practical introduction
Balisage - EXPath - A practical introductionBalisage - EXPath - A practical introduction
Balisage - EXPath - A practical introductionFlorent Georges
 
OpenStack Best Practices and Considerations - terasky tech day
OpenStack Best Practices and Considerations  - terasky tech dayOpenStack Best Practices and Considerations  - terasky tech day
OpenStack Best Practices and Considerations - terasky tech dayArthur Berezin
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 introTerry Cho
 
NetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talksNetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talksRuslan Meshenberg
 
Js engine performance
Js engine performanceJs engine performance
Js engine performancepaullfc
 
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...Wong Hoi Sing Edison
 
Scaling Up Logging and Metrics
Scaling Up Logging and MetricsScaling Up Logging and Metrics
Scaling Up Logging and MetricsRicardo Lourenço
 
Building RESTtful services in MEAN
Building RESTtful services in MEANBuilding RESTtful services in MEAN
Building RESTtful services in MEANMadhukara Phatak
 
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!ddrschiw
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureColin Mackay
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014Hojoong Kim
 
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...confluent
 
Manila, an update from Liberty, OpenStack Summit - Tokyo
Manila, an update from Liberty, OpenStack Summit - TokyoManila, an update from Liberty, OpenStack Summit - Tokyo
Manila, an update from Liberty, OpenStack Summit - TokyoSean Cohen
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideMohanraj Thirumoorthy
 
AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09Chris Purrington
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using KafkaKnoldus Inc.
 

Semelhante a EXPath Webapp - CXAN: a case-study for Servlex, an XML web framework (20)

Galaxy
GalaxyGalaxy
Galaxy
 
Balisage - EXPath - A practical introduction
Balisage - EXPath - A practical introductionBalisage - EXPath - A practical introduction
Balisage - EXPath - A practical introduction
 
OpenStack Best Practices and Considerations - terasky tech day
OpenStack Best Practices and Considerations  - terasky tech dayOpenStack Best Practices and Considerations  - terasky tech day
OpenStack Best Practices and Considerations - terasky tech day
 
Serverless design with Fn project
Serverless design with Fn projectServerless design with Fn project
Serverless design with Fn project
 
Next.js with drupal, the good parts
Next.js with drupal, the good partsNext.js with drupal, the good parts
Next.js with drupal, the good parts
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
NetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talksNetflixOSS Open House Lightning talks
NetflixOSS Open House Lightning talks
 
Js engine performance
Js engine performanceJs engine performance
Js engine performance
 
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...
 
Scaling Up Logging and Metrics
Scaling Up Logging and MetricsScaling Up Logging and Metrics
Scaling Up Logging and Metrics
 
Building RESTtful services in MEAN
Building RESTtful services in MEANBuilding RESTtful services in MEAN
Building RESTtful services in MEAN
 
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
Ad108 - XPages in the IBM Lotus Notes Client - A Deep Dive!
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
Open shift and docker - october,2014
Open shift and docker - october,2014Open shift and docker - october,2014
Open shift and docker - october,2014
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
Creating Connector to Bridge the Worlds of Kafka and gRPC at Wework (Anoop Di...
 
Manila, an update from Liberty, OpenStack Summit - Tokyo
Manila, an update from Liberty, OpenStack Summit - TokyoManila, an update from Liberty, OpenStack Summit - Tokyo
Manila, an update from Liberty, OpenStack Summit - Tokyo
 
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's GuideDeveloping Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
 
AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 

EXPath Webapp - CXAN: a case-study for Servlex, an XML web framework

  • 1. EXPath Webapp CXAN: a case-study for Servlex, an XML web framework th XML Prague, March 26 , 2011 Florent Georges H2O Consulting
  • 2. EXPath Webapp ● Introduction ← ● Webapp, the module ● Data-driven ● Servlex ● The CXAN website ● From scratch ● Conclusion
  • 4. Introduction - Packaging ● A specification to package libraries ● Supported by several processors – eXist – Qizx – Saxon (as 3d party impl) – Calabash (as 3d party impl) ● A package is a standalone file... ● ... a ZIP file with components and a descriptor
  • 5. Introduction - CXAN ● Same idea as CTAN for TeX/LaTeX, or CPAN for Perl, or APT for Debian ● A central, comprehensive, organized collection of packages: – Libraries (XSLT, XQuery, XProc, schemas, …) – Applications (command line, webapps, …) ● Maintained on a central website ● Accessible through a browser ● Accessible through the CXAN client
  • 6. Introduction - Webapp ● Define a web container to deploy webapps ● A webapp is a set of components (in XSLT, XQuery or XProc) ● It has a descriptor to map incoming URIs to specific components ● It is packaged using the Packaging System ● A webapp is able to do whatever is possible to do with HTTP on server-side ● That is, it is able to build your website
  • 7. Introduction - Samples ● An existing implementation of EXPath Webapp is Servlex ● Some existing websites deployed on Servlex: – http://expath.org/ – http://h2oconsulting.be/ – and... http://cxan.org/ ● Of interest: – http://h2oconsulting.be/xqts/ – http://h2oconsulting.be/tools/dump
  • 8. EXPath Webapp ● Introduction ● Webapp, the module ← ● Data-driven ● Servlex ● The CXAN website ● From scratch ● Conclusion
  • 9. Webapp - Goal ● The final, user-level goal is to be able to respond to any HTTP request on the server (so implementing websites, web services, etc.) ● Webapp is aimed at defining a processor- agnostic web container for XML technologies ● The web container allows one to deploy web applications written directly in XSLT, XQuery and/or XProc ● A webapp is interoperable as long as it respects the rules in the Webapp spec
  • 10. Webapp - Components ● Components are either: – XProc step – XProc pipeline – XQuery function – XQuery main module – XSLT function – XSLT named template – XSLT stylesheet
  • 11. Webapp - At 10,000 feet ● The Webapp Module defines a web container responding to HTTP requests ● The processing is defined by user applications
  • 12. Webapp - Overall processing ● Under the hood, the URI of each HTTP request is inspected ● It is used to choose an application to serve it ● It is then used to pick a component within the application, using its own map ● The component is evaluated with an XML representation of the HTTP request ● The component result is an XML rep of the HTTP response to send back
  • 13. Webapp - 1:1 scale
  • 14. Webapp – The request ● Represent the HTTP request in XML ● Easy access to specific pieces using XPath
  • 15. Webapp – The response ● Represent the HTTP response in XML ● Returned by the component called with the request element
  • 16. Webapp – The dispatcher ● Based on the web descriptor ● It maps URI to components, using regexs
  • 17. Webapp – The dispatcher
  • 18. Webapp - Filters & Co. ● The dispatcher can perform more complex processing ● According to the map, it can setup filters, error handlers, chain them, and order them ● Error handlers help setting a consistent error reporting mechanism ● Filters can apply a consistent layout, inject data, handle authentication, or build a dedicated data model for the application
  • 19. Webapp - Packaging ● Webapp defines how to package a webapp ● It builds on the EXPath Packaging System ● Basically, a webapp file is a standard package with a web descriptor, expath-web.xml ● Standard packaging tools can be used for web applications ● A webapp itself can be published on CXAN, thus retrieved and installed automatically in a web container's repository
  • 20. EXPath Webapp ● Introduction ● Webapp, the module ● Data-driven ← ● Servlex ● The CXAN website ● From scratch ● Conclusion
  • 21. Data - What's different? ● The framework is data-oriented, in particular the web:request and web:response elements ● What is different? Nothing, one could argue ● But in the developer's eyes – More clear, easier to learn – Easier to log, and to investigate bug reports ● Easy to create: – A custom data layer dedicated to the app – Filters transforming inputs & outputs
  • 22. Data - Testability ● The web:request and web:response elements are the interface between the application components and the web container ● Because they are data, it is easy to create them by hand or generate them, and to save them on disk and in a revision control system ● Even at the highest level, no need of plenty of dedicated functional test tools to simulate the behavior of the web container, a web:request element describes a complete HTTP request
  • 23. Data - Testability, say it again A webapp is unit-testable all along the way, up to the very top of the stack
  • 24. EXPath Webapp ● Introduction ● Webapp, the module ● Data-driven ● Servlex ← ● The CXAN website ● From scratch ● Conclusion
  • 25. Servlex - Intro ● Servlex in one implementation of the web container defined in the Webapp Module ● It is open-source ● It is available at http://servlex.googlecode.com/ ● It is written in Java ● On the network hand, it uses Java Servlet technology, for the link to HTTP ● On the XML hand, it uses Saxon and Calabash, as its XSLT, XQuery and XProc processors
  • 26. Servlex - Install ● Servlex is a standard WAR file ● It can be deployed in Tomcat, Jetty, Glassfish, but also in Google Appengine and Amazon Cloud EC2 (you know, that cloud thing) ● The only config is to point to a standard on- disk package repository (by setting a Java system property) ● It contains a admin interface to manage and install web applications and packages
  • 28. Servlex - Google Appengine ● Google Appengine does not allow disk access ● The repository is all in the classpath ● The set of webapps is therefore fixed in the Servlex instance deployed on Appengine ● http://fgeorges.appspot.com/expath/ as an example ● Could be deployed in other cloud systems
  • 29. EXPath Webapp ● Introduction ● Webapp, the module ● Data-driven ● Servlex ● The CXAN website ← ● From scratch ● Conclusion
  • 30. CXAN - The website ● The central part of CXAN is its website ● It can be browsed as a website or used via its well-defined REST-like API ● There is a command-line client, but there can be several of them, e.g. in an XML database ● It stores packages (XAR files + distributions) ● It organizes them by name, and by using tags, categories, and authors, as well as a CXAN ID ● A package stores additional infos in cxan.xml
  • 32. CXAN - Architecture ● One component for each page (in XProc) ● There is a global error handler, catching XPath errors, returning a user-friendly error page ● The components return a page document ● There is a global output filter, transforming page documents into full HTML pages, with consistent layout ● Based on the HTTP Accept header, they can return XML instead (for REST-style calls)
  • 33. EXPath Webapp ● Introduction ● Webapp, the module ● Data-driven ● Servlex ● The CXAN website ● From scratch ← ● Conclusion
  • 34. From scratch - Old school ● A webapp is a standard package ● So it is a ZIP file, with a particular structure ● So it must contain a package descriptor ● The package descriptor identifies components (by assigning them public import URIs) ● It contains a web descriptor (expath-web.xml), linking request URIs patterns to components
  • 35. From scratch - New age ● Maintaining the package descriptor separately from the components is painful ● So is creating the ZIP file ● A standard tool, based on some project infos, annotations in the components and a project structure, builds the package descriptor and the ZIP file ● We have to write the web descriptor, be we could improve the tool to use annotations
  • 36. From scratch - Project structure
  • 37. EXPath Webapp ● Introduction ● Webapp, the module ● Data-driven ● Servlex ● The CXAN website ● From scratch ● Conclusion ←
  • 38. EXPath Universe - Once again
  • 39. Join the mailing list and install Servlex: http://expath.org/ http://servlex.googlecode.com/