1 / 11

Chapter 34 Java Technology for Active Web Documents

Chapter 34 Java Technology for Active Web Documents. methods used to provide continuous Web updates to browser Server push Active documents. Browser updates via Server Push.

urban
Download Presentation

Chapter 34 Java Technology for Active Web Documents

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 computer’s 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. <applet codebase=www.calstatela.edu/example code=”bbb.class”> • 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.

More Related