34
http:// wwwis.win.tue.nl / / department of mathematics and computer science / architecture of information systems technische universiteit eindhoven TU/e webserver programming ICT voor O&O cursus 515 2,3,9 mar 2005

webserver programming

  • Upload
    tokala

  • View
    39

  • Download
    2

Embed Size (px)

DESCRIPTION

webserver programming. ICT voor O&O cursus 515 2,3,9 mar 2005. day 1. general introduction what is the web? what do we mean by webserver programming? when to use it? what does it look like? first introduction to Java servlets. the course is only a first introduction!. “you know Java” - PowerPoint PPT Presentation

Citation preview

Page 1: webserver programming

http://wwwis.win.tue.nl/

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/e

webserver programming

ICT voor O&O

cursus 515

2,3,9 mar 2005

Page 2: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eday 1

• general introduction

• what is the web?

• what do we mean by webserver programming?

• when to use it?

• what does it look like?

• first introduction to Java servlets

Page 3: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ethe course is only a first introduction!

“you know Java”

“you know HTML”

we assume limited experience with them

Page 4: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewe will not teach you:

• Frontpage, Dreamweaver, etc.

• website layout management (off-topic)

• website content management

• computer programming

• Java

• ASP, .NET, PHP, etc. (not used with Java)

• specific Java technology such as JINI, JAXL, JDBC, J… (too

advanced)

Page 5: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eweb technology

What is the web made of?

What does web interaction do?

What do we need server-side programming for?

What does a webserver do?

How does it fit into the webserver?

Page 6: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is the web made of?

consider a user interacting with a webpage

what technology does it take?

Page 7: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/e

webpagesshown in

web client (browser)

webserver

documents

scripts

anotherwebserver

databaseetc.

what is the web made of?

Page 8: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is the web made of?

webserver

documents

scripts

anotherwebserver

database

web protocol

TCP/IP (Internet)protocols

low-level protocol

cables

webserver

TCP/IP (Internet)support

operating system

computerhardware

web browser

TCP/IP (Internet)support

operating system

computerhardware

Page 9: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat does web interaction do?

webserver

documents

scripts

anotherwebserver

database

HTTP

TCP/IP (Internet)protocols

low-level protocol

cables

Apache

www.win.tue.nl

Unix

Sun SPARC

MS IE 6

this computer

Windows 2000

Intel-based PC

rp URL: http://www.win.tue.nl/ictoo/

GET /ictoo/

document + headers

rendereddocument

Page 10: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/equiz time!

• what does http://www.win.tue.nl/ictoo/ mean?

• what happens when a user clicks on a link to it?

• what does http://

wwwis.win.tue.nl/~rpost/webprog/cgi/tictactoe.cgi?move=5

mean?

• why are URLs a good idea?

Page 11: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eweb technology

x What is the web made of?

x What does web interaction do?

What do we need server-side programming for?

What does a webserver do?

How does it fit into the webserver?

Page 12: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

to create applications!

example:

http://wwwis.win.tue.nl/~rpost/webprog/cgi/tictactoe.cgi

Page 13: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: tic-tac-toe (2)

We can play tic-tac-toe with HTML files.

Limitations?

Page 14: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: tic-tac-toe (3)

We can play tic-tac-toe with HTML files.

Limitations:

• every response is fixed

• we can’t save the score on the server

• too many HTML files

• changing the layout is a tedious job

• changing the machine’s strategy is hard

• communication between players: ?

Page 15: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: tic-tac-toe (4)

With a server-side program to generate the pages,

all limitations disappear:

• a response can depend on anything

• we can save the score on the server and show it

• no more duplication of HTML

• changing the layout is a one-time operation

• changing the machine’s strategy is easy

• users can play/chat/… via the application

Page 16: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

conclusion: server-side programming supports

• generic layout

• generic functionality

(“generic”: for all webpages at once)

Page 17: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

do people create tic-tac-toe games in HTML?

• yes, many websites are! e.g.

http://www.win.tue.nl/index.html

we will return to this example

Page 18: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eserver-side web applications vs …

client-side web applications

example: the Pacman applet by Benny Chow

• written in Java (source code is available)

• this is a Java applet (client-side web app),

not a Java servlet (server-side web app)

• (this course is about server-side web apps)

Page 19: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eserver-side web applications vs. …

client-side web applications: (e.g. Pacman):

• can have a much more powerful user interface

• require special web browser capabilities (plugins)

• must be written to run in user’s web browser

standalone (non-web) applications:

• even more powerful

• must be downloaded and installed on the user’s OS

• must be written to run on the user’s OS

Page 20: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eserver-side web applications

• limited interaction in user interface

• software + content + gathered data

reside on server

factors determining whether to use server-side web application:

security, availability, reliability, portability, maintainability,

manageability, UI flexibility, …

Page 21: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eweb technology

x What is the web made of?

x What does web interaction do?

/ What do we need server-side programming for?

What does a webserver do?

How does it fit into the webserver?

Page 22: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: www.win.tue.nl (2)

• http://www.win.tue.nl/index.html

consists of HTML pages + images

• layout, images, buttons designed in

Photoshop

• first prototype made in FrontPage

• alternative with server-side programming:

http://www.win.tue.nl/

Page 23: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: www.win.tue.nl (3)

problems: maintaining consistency in look & feel

• (not all Photoshop layouts and images can be used on the web)

• not everybody uses FrontPage

• some parts of the site are already generated with

software; FrontPage doesn’t support that

• how to convert existing pages?

• virtually impossible to change the look and feel

while the site is up and running

Page 24: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: www.win.tue.nl (4)

answer: server-side programming

• the TU/e “webfilter”

• generates a common look & feel for arbitrary

webpages on the fly

• example: http://wwwstijl.tue.nl/filter43/http://wwwis.win.tue.nl/~rpost/webpro

g/cgi/tictactoe.cgi

Page 25: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: www.win.tue.nl (5)

“webfilter” vs. FrontPage

• solves all of the problems mentioned

• must be tuned (by a programmer) to work

on specific ranges of pages

• requires an uncommon way of authoring

• hard to sell

(users don’t trust it, techs don’t trust it)

Page 26: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is server-side programming for?

example: www.win.tue.nl (6)

more viable: a Content Management System (CMS)

• CMS = server-side web application for website

authoring and management

• solves most of the problems mentioned

• limits author to range of options supported by

CMS

• very popular

• example: www.win.tue.nl (uses the Typo3 CMS)

Page 27: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eready-to-use server-side programming

software packages you can freely install, configure, and use;

examples:

• CMS software

• wiki software

• blogging software

• database managers (e.g.

http://www.petriweb.org/phpMyAdmin

• much much more

Page 28: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eweb technology

x What is the web made of?

x What does web interaction do?

x What do we need server-side programming for?

What does a webserver do?

How does it fit into the webserver?

Page 29: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/e

webpagesshown in

web client (browser)

webserver

documentsscripts

anotherwebserver

database etc.

Java servlets

where does server-side scripting fit in?

Page 30: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/ewhat is a webserver made of?

• core functionality e.g. serving files from the filesystem

• built-in document generation e.g. error messages,

status messages

• getting a document from an executable (CGI)

• special webserver modules for scripting /

programming (SSI; PHP; Java servlets; ASP; etc)

Page 31: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eCGI: Common Gateway Interface

a standard way to call external programs from a

webserver

and let them return a document

Page 32: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eCGI: example

tic tac toe of course:

http://wwwis.win.tue.nl/~rpost/webprog/cgi/tictactoe.cgi

source code will be made available

Page 33: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eweb technology

x What is the web made of?

x What does web interaction do?

x What do we need server-side programming for?

x What does a webserver do?

x How does it fit into the webserver?

Page 34: webserver programming

/ department of mathematics and computer science/ architecture of information systems

technische universiteit eindhovenTU/eservlets

difference with CGI scripts:

scripting engine is integrated with webserver

• more efficient

• requires special webserver support