SDPL 2002Notes 7: Apache Cocoon1 7 XML Web Site Architecture Example: Apache Cocoon, a Web publishing architecture based on XML technology

Slides:



Advertisements
Similar presentations
Overview Environment for Internet database connectivity
Advertisements

ASP.NET Intro An introduction to the languages and communication of an ASP.NET system.
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
DT228/3 Web Development WWW and Client server model.
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
Languages for Dynamic Web Documents
1 Chapter 12 Working With Access 2000 on the Internet.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
DT228/3 Web Development JSP: Directives and Scripting elements.
XML-Enabled Database System Mark Graves. This presentation is Copyright 2001, 2002 by Mark Graves and contains material Copyright 2002 by Prentice Hall.
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
WWW and Internet The Internet Creation of the Web Languages for document description Active web pages.
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
DSpace XML UI Project Texas A&M University Digital Initiatives, Research and Technology Scott Phillips, Cody Green, Alexey Maslov, Adam Mikeal, Brian Surratt,
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
XML for E-commerce IV Helena Ahonen-Myka. In this part... n Some solutions for delivering dynamic content n Example of using XML.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
JSP Standard Tag Library
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
1 Understanding Cocoon2 Pankaj Kumar May 24, 2001 Web Services Organization HPMD, SSO, HP.
With your friendly Web Developer, Chris.. Terminology  HTML - > Hypertext Markup Language  CSS -> Cascading Style Sheet  open tag  close tag  HTTP->Hypertext.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
SDPL 2001Notes 7: XML Web Sites1 7 XML Web-Site Architectures n How (and why) to apply XML techniques in the implementation of Web sites? 7.1 XML, Databases,
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 14 Networks, Multi-Tier Architectures, and XML.
From Creation to Dissemination A Case Study in the Library of Congress’s use Open Source Software DLF Spring Forum Corey Keith
HTML and Style. Session overview Leveling-off on the basic concepts of HTML and Styles Discuss Web authoring options.
DSpace UI Alexey Maslov. DSpace in general A digital library tool useful for storage, maintenance, and retrieval of digital documents Two types of interaction:
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Using Cocoon Page 2 Ovidiu Predescu April 5th, 2001 Using Cocoon to build Web sites for wireless devices Ovidiu Predescu Hewlett Packard ApacheCon 2001.
Using Cocoon Page 2 Ovidiu Predescu April 5th, 2001 Using Cocoon to build Web sites for wireless devices Ovidiu Predescu Hewlett Packard ApacheCon 2001.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
Web Design and Development for E-Business By Jensen J. Zhao Copyright 2003 Prentice Hall, Inc. Web Design and Development for E-Business Jensen J. Zhao.
March 28, 2001XSP Session O’Reilly Enterprise Java Conference 1 XSP Session Sue Spielman President/Consulting Engineer President/Consulting Engineer
Web Server Programming 3. Server side includes. HTML+ (‘hole’) technologies Uses ‘HTML+”, HTML (or XML) extended with code. Very many different varieties.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
SDPL 2001Notes 7.2: Apache Cocoon1 7.2 Apache Cocoon An example of a Web publishing architecture based on XML technology An.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Overview Web Session 3 Matakuliah: Web Database Tahun: 2008.
Session: 1. © Aptech Ltd. 2Introduction to the Web / Session 1  Explain the evolution of HTML  Explain the page structure used by HTML  List the drawbacks.
METS Dissemination METS Opening Day Corey Keith
1 Overview of XSL. 2 Outline We will use Roger Costello’s tutorial The purpose of this presentation is  To give a quick overview of XSL  To describe.
AxKit A member of the Apache XML project Ryan Maslyn Kyle Bechtel.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Basic JSP Celsina Bignoli Problems with Servlets Servlets contain –request processing, –business logic –response generation all lumped.
Martin Kruliš by Martin Kruliš (v1.1)1.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Cocoon An XML Web Publishing Framework From the Apache Project Roland Schweitzer.
Introduction to the World Wide Web & Internet CIS 101.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
1 LM 6 Database Applications Dr. Lei Li. Learning Objectives Explain three components of a client-server system Describe differences between a 2-tiered.
Apache Cocoon – XML Publishing Framework 데이터베이스 연구실 박사 1 학기 이 세영.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
Java Server Pages Can web pages be created specially for each user?
Unit 4 Representing Web Data: XML
XML in Web Technologies
PHP / MySQL Introduction
Chapter 7 Representing Web Data: XML
MSIS 655 Advanced Business Applications Programming
An XML Web Publishing Framework From the Apache Project
Chapter 27 WWW and HTTP.
A Match Made In (Ethereal) Heaven
XML Problems and Solutions
Presentation transcript:

SDPL 2002Notes 7: Apache Cocoon1 7 XML Web Site Architecture Example: Apache Cocoon, a Web publishing architecture based on XML technology Example: Apache Cocoon, a Web publishing architecture based on XML technology –Apache: "XML publishing framework" »runs as a servlet (Java class under the control of a Web server, to handle incoming HTTP request) –Cocoon 1 (1999 –); not supported anymore –Cocoon 2 »more efficient (based on SAX instead of DOM) »better site administration (with "sitemaps")

SDPL 2002Notes 7: Apache Cocoon2 Cocoon Philosophy (1/2) n Separation of concerns with "pyramid of contracts":

SDPL 2002Notes 7: Apache Cocoon3 Cocoon Philosophy (2/2) Different responsibilities  different groups Different responsibilities  different groups –Site administrators, Developers, Content producers, Style designers –related declarations separated in different files –supports co-operation of specialised groups –enhances system modularity and extensibility –allows re-use of solutions to different tasks n Content, logic and style merged using XSL transformations

SDPL 2002Notes 7: Apache Cocoon4 Example of typical use n Automatic generation of HTML from (static or generated) XML documents –client-dependent processing possible, serving, e.g., »HTML to "typical" web browsers »WML to WAP-devices »XML to XML/XSL aware clients –also more sophisticated formatting (FOP  PDF) n In Cocoon 1 processing of a request (by a sequence of Processors and a Formatter) controlled by embedded processing instructions (See next)

SDPL 2002Notes 7: Apache Cocoon5 Example (of Cocoon 1) n Different views of content for different clients: <?xml-stylesheet href = "welcome-wml.xsl" type="text/xsl" media="wap"?> type="text/xsl" media="wap"?> <myMessage> Welcome to XML! Welcome to XML! </myMessage>

SDPL 2002Notes 7: Apache Cocoon6 Example (of Cocoon 1) Cocoon 1 configured to handle various User- Agents of the HTTP request Cocoon 1 configured to handle various User- Agents of the HTTP request –explorer, opera, lynx, netscape, java, wap Default style sheet welcome.xsl specifies generation of HTML, and welcome-wml.xsl processing for WAP devices Default style sheet welcome.xsl specifies generation of HTML, and welcome-wml.xsl processing for WAP devices –See next

SDPL 2002Notes 7: Apache Cocoon7 Stylesheet welcome-wml.xsl <xsl:stylesheet version = "1.0" xmlns:xsl=" > <!-- Add a Cocoon instruction to format the result as WML: --> type = "text/wml" type = "text/wml" … …

SDPL 2002Notes 7: Apache Cocoon8 Style sheet welcome-wml.xsl (2) <wml><card> This page has been transformed This page has been transformed from XML into WML by Cocoon's XSLT processor. from XML into WML by Cocoon's XSLT processor. </xsl:stylesheet>

SDPL 2002Notes 7: Apache Cocoon9 Cocoon 2 Pipeline n Pipeline: sequence of component interactions to process a request –typical case:

SDPL 2002Notes 7: Apache Cocoon10 Main Components of Cocoon 2 (1/2) n Generators create XML as a SAX stream. E.g: –FileGenerator: XML file  SAX stream –HTMLGenerator: HTML file  XHTML (as SAX stream) –… (and more components can be added) n Transformers manipulate a SAX stream and pass the result to the next component –XSLT Transformer (default) –Include Transformers (for XML inclusion via URL) –SQL Transformer (to access a DB, and include results) –…

SDPL 2002Notes 7: Apache Cocoon11 Components of Cocoon 2 (2) n Serializers render a SAX stream to some result format (interpretable by the client) –HTML Serializer (default) –XML Serializer, Text Serializer –PDF/PS Serializer (based on FOP) –… n Components and pipelines declared in a Sitemap –In XML file sitemap.xmap (translated to sitemap_xmap.java )

SDPL 2002Notes 7: Apache Cocoon12 Selecting a Pipeline

SDPL 2002Notes 7: Apache Cocoon13 Declaring Pipelines <map:sitemap xmlns:map=" > … xmlns:map=" > … … …

SDPL 2002Notes 7: Apache Cocoon14 Setting up a pipeline

SDPL 2002Notes 7: Apache Cocoon15 XSP (Extensible Server Pages) n Cocoon technology for dynamic content n Procedural code within static document content –similar with other server pages like JSP or ASP –XML document containing tag-based directives for generating dynamic content at request time –translated by XSP processor into Cocoon Generators

SDPL 2002Notes 7: Apache Cocoon16 XSP: Embedding code into pages Example ( time.xsp ); Display the time of day: Example ( time.xsp ); Display the time of day: //Variable for the time of day: //Variable for the time of day: Date now = new Date(); Date now = new Date(); It’s now now It’s now now </xsp:page> n XSP processor generates a Generator...

SDPL 2002Notes 7: Apache Cocoon17 XSP page as Generator (fragments of) public class time_xsp extends XSPGenerator { … //Variable for the time of day: … //Variable for the time of day: Date now = new Date(); Date now = new Date(); public void generate() throws SAXException { public void generate() throws SAXException {this.contentHandler.startDocument(); AttributesImpl attrs=new AttributesImpl(); attrs.addAttribute("", "title", "title", "CDATA", "Time of Day"); "CDATA", "Time of Day");this.contentHandler.startElement("", "page", "page", attrs); …this.contentHandler.endDocument();}

SDPL 2002Notes 7: Apache Cocoon18 XSP to Generated Content to Result

SDPL 2002Notes 7: Apache Cocoon19 Example Result n Final HTML page could be: <html> Time of Day Time of Day <body> It's now Thu Dec 23 20:11:18 PST 1999 It's now Thu Dec 23 20:11:18 PST 1999 </body></html> n OK, but can also separate logic from content (See next)

SDPL 2002Notes 7: Apache Cocoon20 Library Tags n Could replace the preceding with a library tag:... It's now... –Separation of concerns: »programmers encapsulate behaviour in dynamic tags »content authors use application-oriented markup to write XML documents n Tag library: set of custom tags –for including code in documents –with its own namespace

SDPL 2002Notes 7: Apache Cocoon21 Implementation of Tag Libraries n Tag library implemented by a logic sheet –XSLT stylesheet translating XSP  XSP –registered in configuration file cocoon.xconf could be implemented by template formatDate(new Date(), "<xsl:value-of formatDate(new Date(), "<xsl:value-of />"); </xsl:template>

SDPL 2002Notes 7: Apache Cocoon22 Using Tag Libraries

SDPL 2002Notes 7: Apache Cocoon23 Logic Sheets and Tag Libraries n Separation of document structure and … –presentation: stylesheets give presentation semantics to tags –processing: logic sheets give procedural semantics to tags n Built-in tag libraries for various dynamic information: –Request: request method & params, protocol, … –Session: methods for HTTP Session –ESQL: SQL database queries

SDPL 2002Notes 7: Apache Cocoon24 ESQL: Example (1/2) <xsp:page language="java" xmlns:xsp=" xmlns:esql=" xmlns:esql=" connectionName connectionName <esql:query> SELECT name, addr FROM Emp SELECT name, addr FROM Emp</esql:query> …

SDPL 2002Notes 7: Apache Cocoon25 ESQL: Example (2/2) Sorry, no results! Sorry, no results! </esql:connection></xsp:page>

SDPL 2002Notes 7: Apache Cocoon26 Cocoon used in practise? n April 2001: –57 Web sites powered by Cocoon 1 n April 2002: –34 Web sites powered by Cocoon 1 –17 Web sites powered by Cocoon 2 »(34+17 < 57 !) – 9 service providers offering "Cocoon hosting"

SDPL 2002Notes 7: Apache Cocoon27 Summary n Apache Cocoon –"Publishing framework" based on XML technology »esp. on XSLT transformations –Configurable architecture » Components » Sitemap –XSP and tag libraries for dynamic content n Interesting and promising concept –Ideas may survive, perhaps in different systems »(E.g. IBM ServletManager?)