XML IV: Cocoon 2 - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

XML IV: Cocoon 2

Description:

XML IV: Cocoon 2 – PowerPoint PPT presentation

Number of Views:81
Avg rating:3.0/5.0
Slides: 29
Provided by: Martin1095
Category:
Tags: xml | cocoon

less

Transcript and Presenter's Notes

Title: XML IV: Cocoon 2


1
XML IV Cocoon 2
2
The Reactor Pattern
Das Reactor Pattern ermöglicht Demultiplexing
und Verteilung von Service Requests bei
ereignisgesteuerten Anwendungen.
3
The Reactor Pattern
4
Architektur
Webserver
Servlet Container
DB
wml
html
pdf
Serializer
Transform
Generator
5
Pyramiden Modell von Web Verträgen
  • Management Pfade, Verteilung, Regeln,
    Organisation
  • Logic dynamische Generierung
  • Content Seiten Inhalt
  • Style Layout

6
Grundkonzept Pipeline
  • Umleitung nach Muster
  • Erzeugung des XML Dokuments
  • Transformation
  • Ausgabe, Erzeugung von spez. Formaten (html, pdf,
    wml, usw.)

7
Pipeline
8
Architektur
  • Core
  • configuration,threading, context,
  • caching, pipeline handling,
  • program generation, compilation,
  • loading and execution.
  • Components
  • generators, transformers
  • matchers, serializers

9
Sitemap
  • lt?xml version"1.0"?gt
  • ltmapsitemap xmlnsmap"http//apache.org/cocoon/
    sitemap/1.0"gt
  • ltmapcomponents/gt
  • ltmapviews/gt
  • ltmapresources/gt
  • ltmappipelines/gt
  • ltmapaction-sets/gt
  • lt/mapsitemapgt

10
Sitemap II
  • ltmapcomponentsgt
  • ltmapgenerators/gt
  • ltmaptransformers/gt
  • ltmapserializers/gt
  • ltmapreaders/gt
  • ltmapselectors/gt
  • ltmapmatchers/gt
  • ltmapactions/gt
  • lt/mapcomponentsgt

11
Anwendung Legi
  • 1.) Legi Daten von Studenten in
  • ausgeben.
  • xml ? html legi_html.xsl
  • xml ? pdf legi_pdf.xsl
  • xml ? ps ?
  • xml ? wml legi_wml.xsl

12
Sitemap Legi I
  • lt?xml version"1.0"?gt
  • ltmapsitemap xmlnsmap"http//apache.org/cocoon/s
    itemap/1.0"gt
  • lt!-- Components
    --gt
  • ltmapcomponentsgt
  • ltmapgenerators default"file"/gt
  • ltmaptransformers default"xslt"/gt
  • ltmapreaders default"resource"/gt
  • ltmapserializers default"html"/gt
  • ltmapselectors default"browser"/gt
  • ltmapmatchers default"wildcard"/gt
  • ltmapserializer name"fo2ps"
    src"org.apache.cocoon.serialization.FOPSerializer
    " mime-type"application/postscript"/gt
  • ltmapserializer name"fo2pdf"
    src"org.apache.cocoon.serialization.FOPSerializer
    " mime-type"application/pdf"/gt
  • ltmapserializer name"wap"
    mime-type"text/vnd.wap.wml" src"org.apache.cocoo
    n.serialization.XMLSerializer"gt
  • ltdoctype-publicgt-//WAPFORUM//DTD WML
    1.1//ENlt/doctype-publicgt
  • ltdoctype-systemgthttp//www.wapforum.or
    g/DTD/wml_1.1.xmllt/doctype-systemgt
  • ltencodinggtASCIIlt/encodinggt
  • ltomit-xml-declarationgtyeslt/omit-xml-de
    clarationgt
  • lt/mapserializergt

13
Sitemap Legi II
  • ltmapmatch pattern"..html"gt
  • ltmapgenerate src"xml/1.2.xml"/gt
  • ltmaptransform src"xsl/legi_html.xsl
    "/gt
  • ltmapserialize type"html"/gt
  • lt/mapmatchgt
  • ltmapmatch pattern"..pdf"gt
  • ltmapgenerate src"xml/1.2.xml"/gt
  • ltmaptransform src"xsl/legi_pdf.xsl"
    /gt
  • ltmapserialize type"fo2pdf"/gt
  • lt/mapmatchgt
  • ltmapmatch pattern"..ps"gt
  • ltmapgenerate src"xml/1.2.xml"/gt
  • ltmaptransform src"xsl/legi_pdf.xsl"
    /gt
  • ltmapserialize type"fo2ps"/gt
  • lt/mapmatchgt

14
Anwendung Portalseite
  • Alle Dienste einer Seite sollen aufgelistet
    werden.
  • 1.) ? welcome
  • 2.) welcome ? samples.xml ? simple-samples2html.xs
    l ? html
  • 3.) Sitemap für Links

15
samples.xml
  • lt?xml version"1.0" encoding"iso-8859-1"?gt
  • ltsamples xmlnsxlink"http//www.w3.org/1999/xlink
    "gt
  • ltgroup name"Multimedia Hello World"gt
  • ltsample name"HTML" href"hello.html"gt
  • This is a very simple demonstration of how to
    use Cocoon. A simple XML page
  • is transformed into an HTML page.
  • lt/samplegt
  • ltsample name"WML" href"hello.wml"gt
  • Now something more juicy the exact same page
    is translated into WAP WML.
  • lt/samplegt
  • ltsample name"SVG" href"hello.svg"gt
  • Need a fancier look? No problem, SVG is your
    friend.
  • lt/samplegt

16
Sitemap
  • ltmappipelinegt
  • ltmapmatch pattern""gt
  • ltmapredirect-to uri"welcome"/gt
  • lt/mapmatchgt
  • ltmapmatch pattern"welcome"gt
  • ltmapgenerate src"docs/samples/samples.xml"/gt
  • ltmaptransform src"stylesheets/simple-samples2
    html.xsl"/gt
  • ltmapserialize/gt
  • lt/mapmatchgt
  • ltmapmatch pattern"hello.html"gt
  • ltmapgenerate src"docs/samples/hello-page.xml
    "/gt
  • ltmaptransform src"stylesheets/page/simple-pa
    ge2html.xsl"/gt
  • ltmapserialize type"html"/gt
  • lt/mapmatchgt
  • ltmapmatch pattern"hello.wml"gt
  • ltmapgenerate src"docs/samples/hello-page.xml
    "/gt

17
Browser spezifische Seite
  • ltmapselectgt
  • ltmapwhen test"wap"gt
  • ltmaptransform src"stylesheets/simple-sam
    ples2wap.xsl"/gt
  • lt/mapwhengt
  • ltmapwhen test"netscape"gt
  • ltmaptransform src"stylesheets/simple-sam
    ples2netscape.xsl"/gt
  • lt/mapwhengt
  • ltmapotherwisegt
  • ltmaptransform src"stylesheets/simple-sam
    ples2html.xsl"/gt
  • lt/mapotherwisegt
  • lt/mapselectgt

18
eXtensible Server Pages (XSPs)
  • Analog zu JSP
  • nur Trennung von
  • Code
  • Logic
  • Presentation

19
eXtensible Server Pages (XSPs)
  • lt?xml version"1.0" encoding"ISO-8859-1"?gt
  • ltxsppage language"java" xmlnsxsp"http//apache
    .org/xsp"gt
  • ltxsplogicgt
  • static private int counter 0
  • private synchronized int count()
  • return counter
  • lt/xsplogicgt
  • ltpagegt
  • ltpgtI have been requested ltxspexprgtcount()lt/xsp
    exprgt times.lt/pgt
  • lt/pagegt
  • lt/xsppagegt

20
XSP Bsp. II
  • lt?xml version"1.0" encoding"ISO-8859-1"?gt
  • ltxsppage
  • language"java"
  • xmlnsxsp"http//apache.org/xsp"
  • xmlnsxsp-request"http//apache.org/xsp
    /request/2.0"
  • xmlnslog"http//apache.org/xsp/log/2.0
    "
  • xmlnscapture"http//apache.org/cocoon/
    capture/1.0"gt
  • ltpagegt
  • ltloglogger name"xsp-sample"
    filename"xsp-sample.log"/gt
  • ltlogdebuggtjax start jax pagelt/logdebuggt
  • lttitlegtA Simple XSP Pagelt/titlegt
  • ltcontentgt
  • ltcapturefragment-variable name"page_part"gt
  • ltparagtThese 2 paragraphs were generated at
    the start of the XSP, and captured for insertion
    at the end.lt/paragt

21
XSP Bsp. II
  • ltparagtThe following list was dynamically
    generatedlt/paragt
  • ltulgt
  • ltxsplogicgt
  • lt!CDATA
  • for (int i0 ilt3 i)
  • gt
  • ltligt
  • Punkt ltxspexprgtilt/xspexprgt
  • lt/ligt
  • lt!CDATA
  • gt
  • lt/xsplogicgt
  • lt/ulgt
  • ltxsp-requestget-parameter-values
    name"name"/gt
  • ltxsp-requestget-parameter-names/gt
  • ltparagt
  • Header "user-agent" as String

22
Links
  • http//carnagepro.com/samples/
  • http//www.snow-news.com/
  • http//miwis.framkom.se/cocoon/documents/livesites
    .html
  • Praktikum
  • Installation Cocoon
  • Legi mit pdf,html, wml Ausgabe
  • einfach XSP-Seite

23
Download Tomcat 4.0
24
Installieren
25
Ordner Struktur
26
Download Cocoon
27
Extracting cocoon.war
Apache Tomcat 4.0\webapps
28
Test Start Tomcat
Write a Comment
User Comments (0)
About PowerShow.com