Chapter 34 Java Technology for Active Web Documents - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Chapter 34 Java Technology for Active Web Documents

Description:

Java interpreter reads this code an interprets the instructions. automatic garbage collection ... Java which allows a programmer to store applets in source form ... – PowerPoint PPT presentation

Number of Views:246
Avg rating:3.0/5.0
Slides: 12
Provided by: edmun9
Category:

less

Transcript and Presenter's Notes

Title: Chapter 34 Java Technology for Active Web Documents


1
Chapter 34 Java Technology for Active Web
Documents
  • methods used to provide continuous Web updates
    to browser
  • Server push
  • Active documents

2
Browser updates via Server Push
  • a server is responsible to continuously run a
    dynamic document program to produce new versions
    of the document which is sent to the browser.
  • This method causes the server to be overloaded
    whenever there are too many browser clients.
  • Delays arise from limits in available CPU and
    network bandwidth. I

3
Browser updates viaActive documents
  • browser downloads an active document which is
    then run locally on the browser.
  • CPU resources on the server is kept to a minimum
  • network bandwidth usage is kept to a minimum

4
Active Document Representations (fig 34.1)
  • active document in source form is used by
    programmer which is then compiled into active
    document in binary (object) form or machine
    independent(portable) Java bytecode
    representation which is stored on Web server
  • active document in executable form is used by
    browser. It is generated by resolving remaining
    references and linking the the active document in
    binary form to library routines and system
    functions.
  • Java is a technology produced by Sun Microsystems
    for generating active documents

5
Java Components
  • programming language
  • a run-time environment
  • a library of classes
  • The Java library and run-time system provide a
    graphics toolkit (eg. to create buttons,
    pull-down menus, dialog boxes, scroll bar) to
    make graphics programming easier

6
Java Language Characteristics
  • high level general purpose
  • object oriented
  • objects contain data and methods that operate on
    data
  • Similar to C
  • Dynamic
  • an instance of an object is created dynamically
    at run-time
  • strongly typed
  • operations tied to data of particular type
  • Concurrent
  • program can have multiple threads of control
  • threads execute concurrently ie. appear to run at
    same time

7
Java Run-time Environment
  • interpretative execution
  • Java compiler translates a java program into a
    machine-independent binary representation known
    as the java bytecode representation.
  • Java interpreter reads this code an interprets
    the instructions
  • automatic garbage collection
  • program need not call free to free up memory
  • multithreaded execution
  • run-time system has parts of operating system to
    handle scheduling and context switching
  • internet access
  • run-time system includes a socket library that a
    client program can use to contact a remote server
    via TCP or UDP
  • graphics support
  • create windows graphics

8
Uses of Java Library of Classes
  • graphics manipulation
  • allows applet to display text, graphics, or
    dialog boxes
  • low-level network I/O
  • easy access to sockets for UDP or TCP connections
  • interaction with a Web server
  • applet can access static/dynamic Web documents or
    other applets
  • run-time system access
  • allows applet to create a thread
  • file I/O
  • conventional data structures
  • a dictionary class allows storage of items
  • event capture
  • such as mouse clicks or keyboard entry
  • exception handling

9
Java Applet
  • an active Java document
  • A programmer creates an applet by writing a
    source program in Java programming language (fig
    34.2)
  • A java compiler (eg. javac on server
    pluto.calstatela.edu) is then used to translate
    the source program (with extension .java) into
    a bytecode representation ( extension .class),
    and places the bytecode representation on a web
    server.
  • When a browser downloads this program, the Java
    interpreter in the browser executes the applet
    (fig 34.3)
  • To make java applets portable across multiple
    hardware platforms, the java graphics toolkit
    does not manipulate the display hardware.
  • Instead, the run-time system maps Java graphics
    methods to equivalent operations( eg. X windows)
    that use the computers window system.

10
Methods used to invoke an Applet
  • user supplies the URL of an applet (extension
    .class) to a browser that is java enabled
  • eg. http//www.calstatela.edu/example/bbb.class
  • embed an applet tag within an HTML document.
  • eg. ltapplet codebasewww.calstatela.edu/example
    codebbb.classgt
  • When browser encounter the applet tag, a copy of
    the class file will be requested and downloaded
    from the server
  • an instance of class bbb will be created, and the
    init method will be invoked.

11
JavaScript
  • A variation of Java which allows a programmer to
    store applets in source form in HTML page (fig
    34.7).
  • Pro no compiler is needed.
  • Con slower to execute.
Write a Comment
User Comments (0)
About PowerShow.com