part 4
DESCRIPTION
Part 4. Other Topics (Web technologies: HTTP, CGI, Java applets; Middleware). World Wide Web. Major application protocol used on the Internet Simple interface Two concepts Point Click. Web Components. Browser Web server Hypermedia links Document representation Transfer protocol. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/1.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 1
Part 4
Other Topics
(Web technologies: HTTP, CGI,
Java applets; Middleware)
![Page 2: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/2.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 2
World Wide Web
Major application protocol used on the Internet
Simple interface Two concepts
Point Click
![Page 3: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/3.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 3
Web Components
Browser Web server Hypermedia links Document representation Transfer protocol
![Page 4: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/4.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 4
Browser
Application program User’s interface to Web Becomes Web client to fetch information from
Web server Displays information for user
![Page 5: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/5.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 5
Web Server
Running program Stores set of Web documents Responds to request from browser by
sending copy of document
![Page 6: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/6.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 6
Hypermedia Concept
Web document contains mixture of Text Images Selectable pointers to other Web pages
Known as hypermedia
![Page 7: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/7.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 7
Hypermedia Link On A Web Document
Associated with object or area on screen Internally like a symbolic link Advantage
Can reference document on another computer Disadvantage
Can become invalid
![Page 8: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/8.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 8
Web Document
Called a web page One web page per file Can contain
Binary image Text file
Text standard Readable representation ASCII Specifies contents and layout Known as Hypertext Markup Language
(HTML)
![Page 9: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/9.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 9
Terminology
Markup language Gives general layout guidelines Does not specify exact placement or format
![Page 10: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/10.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 10
Consequence of UsingA Markup Language
Web documents use the HyperText Markup Language representation. Instead of specifying a detailed document format, HTML allows a document to contain general guidelines for display, and allows a browser to choose details. Consequently, two browsers may display an HTML document differently.
![Page 11: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/11.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 11
HTML Details
Document is free-format Embedded tags give display guidelines Tags often appear in pairs Tag format
Beginning tag
Ending tag<TAGNAME>
</TAGNAME>
![Page 12: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/12.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 12
General Form of HTML Document
<HTML><HEAD>
<TITLE>text that forms the document title
</TITLE></HEAD><BODY>
body of the document appears here</BODY>
</HTML>
![Page 13: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/13.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 13
Document Format
<HTML><HEAD><TITLE> text that forms the document title</TITLE></HEAD><BODY>body of the document appears here</BODY></HTML>
HTML source is free-formPrevious example equivalent to this
![Page 14: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/14.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 14
Example HTML Tags
Begin paragraph
<P> Line break (force a new line)
<BR> Main heading (largest, boldest font)
<H1> … text … </H1> Next heading (next largest)
<H2> … text … </H2>
![Page 15: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/15.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 15
Example of HTML Line Break
InputHello there.<BR>This is
an example<BR>of HTML.
OutputHello there.
This is an example
of HTML.
![Page 16: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/16.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 16
Example of HTML Line Break (continued)
InputHello there.<BR><BR>This
shows<BR>HTML spacing.
OutputHello there.
This shows
HTML spacing.
![Page 17: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/17.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 17
Example of HTML Headings
InputHello.<BR><H1>This is a
heading</H1><BR>Back to normal.
OutputHello.
This is a headingBack to normal.
![Page 18: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/18.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 18
Other HTML Features
Numbered or unnumbered lists Images Links to other pages
![Page 19: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/19.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 19
Images in HTML
Explicitly denoted as image Specified with image tag Can specify alignment with text Example image tags
<IMG SRC=“file_name”>
<IMG SRC=“file_name” ALIGN=MIDDLE>
![Page 20: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/20.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 20
Images in HTML
Here is a picture. <IMG SRC=“file_name” ALIGN=MIDDLE>
![Page 21: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/21.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 21
Links to Other Pages
Symbolic representation Embedded in HTML document Browser
Hides text of link from user Associates link with item on page Makes item selectable
Called Uniform Resource Locator (URL)
![Page 22: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/22.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 22
General Form of URL
Only domain name required Defaults
Protocol is http Port is 80 Path is index.html
protocol :// domain_name : port / item_name
name of accessprotocol to use domain name of
server computer
protocol portnumber path name
of item
![Page 23: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/23.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 23
Link in HTML
Link specified in <A> tag Applies to successive items Ends with </A> Called anchor
![Page 24: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/24.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 24
Example of Anchor Tag in HTML
InputThe text is published by<A HREF=http://www.prenhall.com>Prentice Hall, </A> one of the larger publishers of ComputerScience textbooks.
ProducesThe text is published by Prentice Hall, one of the larger publishers of Computer Science textbooks.
![Page 25: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/25.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 25
Use of Client-Server Paradigm
Web server Makes set of pages available Uses port 80
Web client Called a browser Creates TCP connections to server Sends requests for items
![Page 26: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/26.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 26
Use of Client-Server Paradigm
Primary protocol used between browser and server known as HyperText Transfer Protocol (HPPT)
HTTP requests sent as text (ASCII) GET: request an item from the server HEAD: request status information about an
item POST: send data to the server
![Page 27: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/27.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 27
Use of Client-Server Paradigm
Response from server begins with ASCII header Status code (200 = handled request)
![Page 28: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/28.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 28
Inside a Browser
Main controller Receives input from user Invokes client and interpreter
Clients One or more built into browser Uses network to fetch items
Interpreter One or more built in Displays items
![Page 29: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/29.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 29
Illustration of a Browser
Browser contains many components
![Page 30: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/30.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 30
Alternative Protocol Example
File transfer service Protocol is FTP Example URL
ftp://ftp.cs.purdue.edu/pub/comer/netbook/client.c
Can be used in anchor tag
![Page 31: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/31.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 31
Other Markup Languages
Extensible Markup Language (XML) does not specify layout
Tag names can be created as needed Example for a corporate phone book:
![Page 32: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/32.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 32
Caching in Browsers
Cache for recently accessed HTML pages Images
Item normally fetched from cache User can override HTTP can verify timestamp before fetching
new copy
![Page 33: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/33.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 33
Types of Web Pages
Static Stored in file Unchanging
Dynamic Formed by server Created on demand Output from a program Use Common Gateway Interface (CGI)
technology
![Page 34: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/34.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 34
Types of Web Pages (cont)
Active Executed at client Consists of a computer program Can interact with user Use Java technology
![Page 35: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/35.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 35
Summary of Web Document TypesWeb documents can be grouped into three categories depending on when the information in the document changes. The information in a static document remains unchanged until the author revises the document. The information in a dynamic document can change whenever a server receives a request for the document. Information displayed by an active document can change after the document has been loaded into a browser.
![Page 36: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/36.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 36
CGI Technology
URL specifies Location of Web server CGI program on that server Arguments to program
Web server Uses TCP for communication Accepts HTTP request from client Runs specified CGI program Returns output to client
![Page 37: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/37.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 37
CGI Technology (cont)
CGI program Performs arbitrary computation Often written in a scripting language Produces output file when run Starts output with header
![Page 38: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/38.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 38
Header in CGI Output
Stops at first blank line Identifies
Encoding used Type of document
Format keyword: information
![Page 39: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/39.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 39
CGI Header Examples
HTML document header
Content Type: text/html Text document header
Content Type: text/plain Redirection header
Location: /over_here/item4
![Page 40: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/40.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 40
Example CGI Script
Generates document Document contains three lines of text
Header Blank line Document creation date
![Page 41: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/41.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 41
Parameters
CGI programs can be parameterized URL can contain arguments that are passed
to CGI program Question mark separates CGI path from
arguments Server places information following question
mark in environment variable QUERY_STRING
![Page 42: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/42.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 42
Example Environment Variables
![Page 43: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/43.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 43
Encoding Information in a URL
Information that program stores between invocations: state information
Information passed to browser in form of cookie
Cookie consists of name/value pair Long term (persistent) or short term (session)
![Page 44: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/44.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 44
Long-Term State Information
Program lifetime CGI program invoked by server Program exits after generating output
To maintain persistent data Write to file on disk Read from file on disk
![Page 45: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/45.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 45
Long-Term State Information
Client’s IP address in environment variable Check if address in file Respond to client
![Page 46: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/46.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 46
Short-Term State Information
Each invocation of a dynamic document program can produce a document containing a new set of URLs
Use new arguments in new URLs
![Page 47: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/47.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 47
Short-Term State Information
Argument encodes number of times executed
![Page 48: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/48.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 48
Example of Script Execution
Initial documentContent-type: text/html<HTML>This is the initial page.<BR><BR><A HREF=“http://www.nonexist.com/cgi/ex4?1”>Click here to refresh the page.</A> </HTML>
Resulting displayThis is the initial page.
Click here to refresh the page.
![Page 49: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/49.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 49
Example of Script Execution
Generated outputContent-type: text/html<HTML>You have displayed this page 2 times.<BR><BR><A HREF=“http://www.nonexist.com/cgi/ex4?2”>Click here to refresh the page.</A> </HTML>
Resulting displayYou have displayed this page 2 times.
Click here to refresh the page.
![Page 50: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/50.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 50
Generated URL Values
When it generates a document, a dynamic document program can embed state information as arguments in URLs. The argument string is passed to the program for the URL, enabling a program to pass state information from one invocation to the next.
![Page 51: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/51.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 51
Server-Side Scripting
ASP (Active Server Pages) JSP (Java Server Pages) PHP (Perl Helper Pages) ColdFusion
![Page 52: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/52.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 52
Server-Side Scripting
Server-side scripting technologies allow a dynamic page to be created from a template or skeleton that contains embedded commands or program scripts. Instead of using a computer program to generate an entire page, an interpreter copies the page and replaces only the scripting commands.
![Page 53: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/53.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 53
Continuously Changing Information Needed for
Animations Rapid updates (e.g., stock prices)
Achieved with two mechanisms Server push Active document
![Page 54: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/54.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 54
Server Push Technology
Client forms connection Server sends updates repeatedly Impractical
![Page 55: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/55.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 55
Active Document Technology
Server Sends computer program to client
Client Runs program locally
Program Controls display Interacts with user
![Page 56: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/56.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 56
Active Document Representation
Desire Platform independence Efficient execution High-speed data transmission Late binding
Consequence Compact representation Interpretive execution
![Page 57: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/57.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 57
Active Document Translation
Compiler produces machine-independent binary Browser interprets binary
![Page 58: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/58.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 58
Java Technology
Developed by Sun Microsystems Used for
Conventional applications Active documents (applets)
Includes Programming language Run-time system Class library
![Page 59: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/59.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 59
Java Language Characteristics
High level General purpose Similar to C++ Object oriented Dynamic Strongly typed Statically type checked Concurrent
![Page 60: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/60.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 60
Java Run-Time Environment Characteristics
Interpretative execution Automatic garbage collection Multi-threaded execution Internet access Graphics support
![Page 61: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/61.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 61
Java Library
Classes for Graphics manipulation Low-level network I/O Interaction with a Web server Run-time system access File I/O Conventional data structures Event capture Exception handling
![Page 62: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/62.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 62
Choice of Graphics Interface
Java includes an extensive graphics toolkit that consists of run-time support for graphics as well as interface software. The toolkit allows a programmer to choose a high-level interface, in which the toolkit handles details, or a low-level interface, in which the applet handles details.
![Page 63: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/63.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 63
Example Java Applet
Window with two items Text area Button
Change text when button clicked
![Page 64: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/64.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 64
Illustration of Applet Display
Initial
After user clicks button
![Page 65: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/65.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 65
Example Applet Code
![Page 66: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/66.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 66
Applet Invocation
Available in HTML Uses applet tag Specifies
Codebase (machine and path) Code (specific class to run)
Example<applet codebase=“www.nonexist.com/pth”
code=“bbb.class”>
![Page 67: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/67.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 67
Java Functionality
HTML interface Controls display Interacts with user
HTTP interface Accesses remote Web documents Invokes other applets
Exceptions Indicate unanticipated circumstances Can be caught and handled
![Page 68: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/68.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 68
Example Applet Code
![Page 69: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/69.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 69
Example Applet Code (continued)
![Page 70: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/70.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 70
Illustration of Applet Display
![Page 71: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/71.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 71
JavaScript Technology
Alternative to Java technology Provides scripting language Browser reads and interprets script in source
form JavaScript can be integrated with HTML
![Page 72: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/72.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 72
JavaScript Example
![Page 73: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/73.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 73
JavaScript Example
![Page 74: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/74.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 74
Middleware
Tools to help programmers Makes client-server programming
Easier Faster
Makes resulting software Less error-prone More reliable
![Page 75: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/75.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 75
Middleware Approach
Allow programmer to work with familiar language constructs
Provide tools to help programmer Special translators Libraries
Automatically generate code for Network communication Connection management
![Page 76: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/76.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 76
Remote Procedure Call
Uses standard procedure call paradigm Divides program along procedure call
boundaries Main program and procedures for user interaction
in client side Other procedures in server side
![Page 77: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/77.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 77
Reason for Remote Procedure Call
If a programmer follows the same procedure call paradigm used to build conventional programs when building client and server software, the programmer will find the task easier and will make fewer mistakes
![Page 78: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/78.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 78
Illustration of Conventional Procedure Call Graph
Arrow denotes procedure call
![Page 79: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/79.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 79
Procedure Call Graph Divided Into Client and Server
Division occurs on call boundary Main program in client piece
![Page 80: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/80.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 80
Communication Stubs
Inserted to enable remote “call” Automatically generated Use original call interface Allow calling and called procedure to remain
unchanged
![Page 81: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/81.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 81
Illustration of Client and Server Stubs
Original call in (a) Same interface with stubs in (b)
![Page 82: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/82.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 82
Creating Stubs
Programmer writes Code for a program Specification of procedure interfaces using
Interface Definition Language (IDL) Middleware generates
Client and server stub code Necessary socket calls Data translation
![Page 83: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/83.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 83
Data Representation
Network can connect heterogeneous computers
Two computers may use different Integer representations Character codes Floating point representations
Translation required
![Page 84: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/84.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 84
Possible Data Translation Schemes
Use receiver’s representation Sender translates all outgoing data
Use sender’s representation Receiver translates all incoming data
Use external representation (popular) Sender translates to external form before sending Receiver translates from external form after
reception
![Page 85: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/85.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 85
Middleware Technologies That Use Remote Procedure Call
ONC RPC Open Network Computing IETF standard Popular in Unix world
DCE RPC Distributed Computing Environment Open Group Standard
![Page 86: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/86.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 86
Middleware Technologies That Use Remote Procedure Call (continued)
MSRPC Microsoft Variant of DCE RPC
![Page 87: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/87.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 87
Object-Oriented Middleware
Designed for use with object-oriented programming languages
Same general scheme as RPC Interface Definition Language Tool to build stubs Libraries to handle network communication
Uses method invocation instead of procedure call
![Page 88: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/88.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 88
Middleware Technologies That Use Remote Object Invocation
CORBA Common Object Request Broker Architecture Well known object-oriented middleware
MSRPC2 Microsoft Also called Object RPC (ORPC)
![Page 89: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/89.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 89
Middleware Technologies That Use Remote Object Invocation
COM / DCOM Also from Microsoft Component Object Model (COM)
Used on single computer Provides mechanism for inter-object references
Distributed Component Object Model Used across multiple computers Includes communication stubs
![Page 90: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/90.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 90
Middleware Technologies That Use Remote Object Invocation
RMI From Sun Microsystems Methods of remote Java objects can be invoked
from other Java virtual machines on different hosts
Jini Also from Sun; based on Java Provides an environment for creating
dynamically networked components, applications, and services that scale
![Page 91: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/91.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 91
Summary
Web is major application in Internet Client
Called browser Fetches and displays document
Web documents Stored on servers Standard representation is HTML
![Page 92: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/92.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 92
Summary (continued)
HTML Markup language Uses tags embedded in text
URL components Protocol Domain name of server Protocol port number Path of item Only domain is required
![Page 93: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/93.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 93
Summary (continued)
Static web page Unchanging
Dynamic web page Output from a program on the server
Active web page Runs in browser Consists of a computer program
![Page 94: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/94.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 94
Summary (continued)
Dynamic web page technology Known as CGI CGI program usually a script Document begins with header line URL can contain arguments
![Page 95: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/95.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 95
Summary (continued)
Active web page technology Known as Java Programming language plus runtime support Document called applet
![Page 96: Part 4](https://reader035.vdocuments.site/reader035/viewer/2022062808/56815520550346895dc2fe37/html5/thumbnails/96.jpg)
FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA 96
Summary (continued)
Middleware Tools to help build client and server Automates routine tasks Two popular paradigms
Remote procedure callObject invocation
Generates communication stubs