Presentation is loading. Please wait.

Presentation is loading. Please wait.

Client-Server applications Introduction to Java Applets Client-server architectures Why do Applets exist? What can an Applet do?

Similar presentations


Presentation on theme: "Client-Server applications Introduction to Java Applets Client-server architectures Why do Applets exist? What can an Applet do?"— Presentation transcript:

1 Client-Server applications N.A.Shulver@staffs.ac.uk Introduction to Java Applets Client-server architectures Why do Applets exist? What can an Applet do? What are they used for? Some technical details Conclusion

2 Client-Server applications N.A.Shulver@staffs.ac.uk Simple client-server architecture Servers may provide different types of services simultaneously to many clients Clients are software entities with a network connection to the server Clients vary in their capabilities – some have very little in the way of resources and are considered “thin”

3 Client-Server applications N.A.Shulver@staffs.ac.uk Thin Client systems Clients may be “thin”, for example a simple information terminal in a library or perhaps a mobile handheld device Thin client systems assume that the bulk of the work is done at the server A thin client is little more than a screen and user- input device(s)‏

4 Client-Server applications N.A.Shulver@staffs.ac.uk Client-Server on the Web Many clients are not thin Desktop computer systems with an Internet connection may be more powerful than the server It is possible to off-load much of the computing work from the server to the client – better for scalability In such cases, the client downloads and runs an application to do work locally

5 Client-Server applications N.A.Shulver@staffs.ac.uk Java client-side solutions Java is a network-centric programming language It has a number of solutions for client-side programming Applets – limited applications that run in a browser WebStart applications – desktop applications with security restrictions that can be launched from a web page Low-level programming of completely general, unrestricted network applications

6 Client-Server applications N.A.Shulver@staffs.ac.uk Why do Applets exist? In 1995, Java became available as a network-aware programming language Applets were part of the language, designed to add complex functionality to Web pages At the time, Applets were the only way to program multimedia on a Web page! Now competes with Flash, SVG and others

7 Client-Server applications N.A.Shulver@staffs.ac.uk Why do Applets exist? Applets provide trusted, secure, portable functionality Cached Applets can be run off-line Applets allow complex calculations to be run on the client machine, including; encryption and secure communication rapid data communication interactive graphics

8 Client-Server applications N.A.Shulver@staffs.ac.uk What can an Applet do? Applets are used for lots of tasks; Online discussions and communication boards Online document editing Banking front-ends Scientific visualisation, e.g. molecule viewers Advertising (although nearly all Flash now)‏ Interactive games in 2D and 3D

9 Client-Server applications N.A.Shulver@staffs.ac.uk Technical Details Applets are written in standard Java Applets are not “complete” applications – they plug into a browser Applets can be assumed to have graphics capability Applets run in a “sandbox” security environment, giving them extremely limited access to the resources of the local machine [usually a good thing!]

10 Client-Server applications N.A.Shulver@staffs.ac.uk Technical Details To make an Applet we write a class that extends Applet (or extends Japplet, the more advanced Swing-based version)‏ Then we write code to override some of the four key methods These are init(), start(), stop() and destroy()‏ There is no public static void main(String[] args)‏

11 Client-Server applications N.A.Shulver@staffs.ac.uk Applet methods Typically we would write code to initialise the Applet in public void init()‏ When the Applet becomes visible, the browser will invoke public void start(), so this is where we “activate” the program (e.g. start an animation running)‏ If the Applet is made invisible we have public void stop() which turns off animations, sounds etc.

12 Client-Server applications N.A.Shulver@staffs.ac.uk Conclusion Clients and servers vary in their needs an capabilities Applets exist to provide rich client capability Applets can be used as portable, security-limited applications For more information, see: Wikipedia on Applets, Client-server and also Sun's Applet overviewApplet Client-serverApplet overview

13 Client-Server applications N.A.Shulver@staffs.ac.uk Practical notes You need to compile the.java files on the schedule into a.class file Need a HTML to call the.class files Applets have no main method and so cannot run on their own Two examples follow to demonstrate Free Applets out on the web but beware!

14 Client-Server applications N.A.Shulver@staffs.ac.uk HTML wrapper

15 Client-Server applications N.A.Shulver@staffs.ac.uk Examples running

16 Client-Server applications N.A.Shulver@staffs.ac.uk HTML wrapper

17 Client-Server applications N.A.Shulver@staffs.ac.uk Examples running


Download ppt "Client-Server applications Introduction to Java Applets Client-server architectures Why do Applets exist? What can an Applet do?"

Similar presentations


Ads by Google