37
TIER 1 Application w ith View er Bean W eb Brow ser Application Server Apache W eb Server DB EJB Fetch DATA TIER 2 TIER 3 Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik [email protected] http://jax.nano-world.org JAVA XML APACHE

Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik [email protected] JAVAXML

Embed Size (px)

Citation preview

Page 1: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

TIER 1

Application with Viewer

Bean

WebBrowser

Application Server

ApacheWeb

Server

DB

EJB

FetchDATA

TIER 2 TIER 3

Praxis der Internet-Programmierung mit Java, Apache und XML (JAX)Institut für [email protected]://jax.nano-world.org

JAVA XML

APACHE

Page 2: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Organisatorisches

Zeiten?Vorlesung: Do 13.00 - 14.00 Uhr Hörsaal 2 EG 0006Praktikum: Do 14.00 - 16.00 Uhr PC-Labor U1075

Wahlfach Informatik: Die Veranstaltung wird mit 3SWS angerechnet.

Fragen an: Karin Liesenfeld

[email protected]

Material: www.ifi.unibas.ch (bald) http://jax.nano-world.org

Page 3: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Praktikum

Ziel: •Max. Ausnutzung des neuen Computerlabors (hohe Bandbreite, moderne Software)

•Praktische Beispiele - in zwei Stunden ein funktionsfähiges Produkt

•1 zu 1 Anwendung der Vorlesung

Testatbedingung:Vorlesung: Anwesenheit

Praktikum: 75% der Produkte müssen lauffähig sein.

Page 4: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Literatur

• B. Eckel, “Thinking in Java”, Second Edition, New Jersey, 2000• M. Hall, “Core Servlets and JavaServer Pages”, NJ, 2000• D. K. Fields, M. A. Kolb, "JavaServerPages", Manning, 2000• D. Chang, D. Harkey, "Client/Server Data Access with Java and XML", Wiley

Computer Publishing, 1998• L. Eilebrecht, "Apache Web-Server", MITP-Verlag Bonn, 2000• J. Farley, "Java Distributed Computing", O'Reilly, 1998• S. Allamaraju et al., "Professional Java Server Programming - J2EE Edition", Wrox

Press, 2000• M. von Löwis, N. Fischbeck, "Python 2", ADDISON-WESLEY, 2001• H. Behme, S. Mintert, "XML in der Praxis" ADDISON-WESLEY, 2000• W. Rockwell, "XML, XSLT, Java und JSP", Galileo Computing, 2001• A.L. Ananda, B. Srinivasan (Eds), "Distributed Computing Systems: Concepts and

Structures", IEEE Computer Society Press, 1991• Sape Mullender (Ed), "Distributed Systems", Addison-Wesley (ACMPress), 1994• Open Software Foundation, "Introduction to OSF(TM) DCE",Prentice Hall, 1992• Andrew S. Tanenbaum, "Computer Networks", Prentice Hall, 1996• Michael Weber, "Verteilte Systeme", Spektrum Akademischer Verlag,1998

Page 5: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Links

http://java.sun.com/http://jakarta.apache.orghttp://www.jguru.comhttp://www.borland.com/jbuilder/https://www.developer.ibm.com/java/member/http://www.microsoft.com/java/http://xml.apache.orghttp://www.rfc-editor.org/http://www4.ulpgc.es/tutoriales/tcpip/pru/http://www.raleigh.ibm.com/cgi-bin/bookmgr/library

Page 6: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Überblick

„Web Services“ , „Application Server“

Diese Begriffe sind heute völlig unklar und versteht darunter, was ihm gerade opportun erscheint.

Eingrenzung dieser Vorlesung auf:

• JAVA Server Anwendungen

• Open Source Produkte Apache

• XML Anwendungen

Page 7: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Zeitplan

25.101.11

8.1115.11

22.1129.116.12

13.1220.12

2002

2002

Page 8: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Im Focus

• Grundlagen der Internetprogrammierung

• Servlet und JSP – Technologie von SUN

• Weitere Opensource Produkte

• Enterprise Java Beans

• XML

Page 9: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Nicht im Focus der Vorlesung

• High End Enterprise Systeme mit J2EE Cluster Farmen (Bsp: Webgain oder Oracle)

• Microsoft NET Strategie

• Sicherheit & Cryptographie

Page 10: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Grundlagen

Client-Server Modell

Internet -> TCP / IPPort

Telnet 23

FTP 21

SMTP 25

URL

HTTP 80

Page 11: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Verschieden Dienste

Client - Server Modell

Client: Anfrage (REQUEST)

Server: Server wartet auf Anfragen

Ausführung der geforderten Anfrage und Antwort (RESPONSE)

Asynchron !!

Client Server

Page 12: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

RFC‘s (Request for Coment)

http://hier.dur.ch/zu/mir/rfc/

http://www.rfc-editor.org/

Page 13: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

wichtige RFC‘s

RFC 1340 Internet-wide wellknown ports

RFC 1305 Network Time Protocol

RFC 821 Simple Mail Transfer Protocol

RFC 2616 HTTP 1.1

RFC 2617 HTTP Authetication

Page 14: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

TCP / IP

Erste Implementation:Computer Systems Research Group at the university of

California at Berkley

BSD System “Berkley Software Distribution”

Sockets, TLI (Transport Layer Interface)

API’s (Aplication programming interface)

using TCP/IP Protokolls.

http://www4.ulpgc.es/tutoriales/tcpip/pru/

(ETHERNET von DEC 1982)

Page 15: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

TCP/IP

IP:Internet Protokoll IP ist ein unzuverlässiger, verbindungsloser Datenpaket Zustellungs- Dienst.

TCP: Transmission Kontroll ProtokollTCP unterstützt einen zuverlässigen, Verbindungsorientierten Byte-stream.

Packet Dienst

Page 16: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Netzwerk Protokolle, Schichten

Schicht: Protokoll:

Anwendung FTP

Transport TCP

Netzwertk IP

Verbindung Ethernet

Hardware

Page 17: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Basis Dienste

Page 18: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Netzwerkkonfiguration

ipconfig

netstat

(man netstat)

Page 19: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

ping, host

Page 20: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

traceroute

Page 21: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

telnet: simple Services

name port RFC

echo 7 862

discard 9 863

daytime 13 867

chargen 19 864

time 37 868

Page 22: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

FTP

Page 23: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

From: <[email protected]>To: <[email protected]>Date: Mon, 22 Oct 2001 11:18:00 +0200 (MET DST)

Simple Mail Transfer Protocol (SMTP)

Unix for freaks:

Mail –v –stest [email protected] <mymail

Page 24: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Unified Resource Locator

Syntax: <prot.>//<user>:<password>@<host>:<port>/<url-path>

telnet://eudora.ifi.unibas.ch:19

ftp://[email protected]/

http://www.google.ch/search?q=Uni+Basel

Page 25: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Hypertext Transfer Protocol

HTTP 1.1

Request – Response

Methoden: GET, POST, HEAD, PUT, DELETE,

TRACE, OPTIONS

http://www.w3.org/Protocols/

Page 26: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

HTTP

GET für Anfragen mit wenig Zusatzinformationen

POST für Anfragen mit grossen Zusatzinformationen

Beispiel (GET-Request):GET /index.html HTTP/1.1User-Agent: Opera/5.02 (Windows 98; U) Host: www.anyhost.chAccept: text/html, image/jpeg, */*

Page 27: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Request Header

Accept

Accept-Charset

Accept-Encoding

Accept-Language

Authorization

Cache-Control

Connection

Content-Length

Content-Type

Cookie

Expect

From

Host

If-Modified-Since

If-None-Match

If-Range

If-Unimodified-Since

Pragma

Proxy-Authorization

Range

Referer

Upgrade

User-Agent

Page 28: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Praktikum HTTP (I)

Werkzeug:HTTPUNIT (httpunit.sourforge.net)JBuilder

Aufgaben:1.) Body einer Homepage lesen2.) Alle Links einer Seite auslesen3.) Eine Tabelle auslesen4.) Ein Formular ausfüllen5.) Alle Links einer Site überprüfen

Page 29: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

1. Httpunit downloaden

http://httpunit.sourceforge.net

Page 30: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

2. Neues Projekt eröffnen

FileNew Project

Page 31: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Klicken

Page 32: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Klicken

Page 33: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML
Page 34: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

3. Neue Klasse einfügen

NewNew Class

Page 35: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

3. Code einfügen

NewNew Class

Page 36: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

4. Starten

RunRun Projects

Klick

Page 37: Praxis der Internet-Programmierung mit Java, Apache und XML (JAX) Institut für Informatik Martin.Guggisberg@unibas.ch  JAVAXML

Httpunit api