Download presentation
Presentation is loading. Please wait.
Published byOsborn Curtis Modified over 9 years ago
1
Java the UML Way http://www.tisip.no/JavaTheUMLWay/ version 2002-04-17 Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18 More about applets A Web server is statelesspage 2 Distributed processingpage 3 The sandbox model in Javapage 4 Security managerpage 5 The applet classes’ place in the class treepage 6 The life cycle of an appletpage 7 Security in practicepage 8 Communication between applet and browserpage 9
2
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 2 A Web Server is Stateless The main task of a Web server is to answer clients’ requests to get files. A HTML page is a fairly ”dead” affair with limited possibilities for manipulation of data (but some with JavaScript). The user may enter data into a form on a Web page. These are sent to the Web server, which could pass it on as input to a program. After this, the Web server forgets this request. It is stateless, like an object without any variables. If the same client continues to work on the same tasks, it can’t suppose that the server remembers the last time they had contact. In practice, the server will in these cases have finished the last sub-task by sending data back to the client. Internet Web server program using the data CGI brow- ser HTTP clientserver
3
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 3 Distributed Processing We can reduce the network traffic by letting the browser download small programs which do calculations and work on data in other ways. The browser runs these programs automatically Other technologies –Java applets –Microsoft ActiveX –Shockwave Flash from Macromedia
4
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 4 The Sandbox Model in Java AppletContext System.out C:\windows /etc/passwd lpt1 Suspicious applet doesn’t get access to many resources on the computer.
5
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 5 Security Manager A security manager is an object of the class SecurityManager. A running Java program can have one of these installed. If the program wishes to perform a task that is a security hazard, it has to ask the security handler for permission. It should not be possible for us to write risky code without having to use methods in the API that perform the security check. An applet always has a security manager installed. The applet can’t change its own security manager.
6
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 6 The Applet Classes’ Place in the Class Tree Object Component JFrame JApplet JInternalFrameDialog JDialog Container WindowJComponentPanel FrameJWindow Applet Not all browsers support Swing. See the book’s web page for relevant information.
7
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 7 The Life Cycle of an Applet The applet is stopped, the user has left the Web page. init() start() stop() destroy() The applet is loaded and starts right away. The applet is running, the user is watching. The applet is out of the world because the browser is closed, or for another reason. loaded runningstopped dead Show program listing 18.1, pp. 568-569. Solve problem page 570.
8
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 8 Security in Practice Show program listings 18.2 and 18.3, pp. 570-571.
9
Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN 0-470-84386-1, John Wiley & Sons Ltd 2002 The Research Foundation TISIP, http://tisip.no/engelsk/ Chapter 18, page 9 Communication Between Applet and Browser Applet context –AppletContext browser = getAppletContext(); –The applet gets a reference to the browser it runs in –Relevant messages to send to the object browser void showDocument(URL url) void showStatus(String statusText) Parameters for the applet, examples Applet which demonstrates use of parameters Your browser does not support applets, or it's turned off. Show program listing 18.4, page 574.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.