17
Client-Server applications [email protected] 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

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

Embed Size (px)

DESCRIPTION

Client-Server applications 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)‏

Citation preview

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

Client-Server applications

[email protected]

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

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

Client-Server applications

[email protected]

Simple client-server architectureServers 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”

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

Client-Server applications

[email protected]

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)

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

Client-Server applications

[email protected]

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

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

Client-Server applications

[email protected]

Java client-side solutions

Java is a network-centric programming language

It has a number of solutions for client-side programmingApplets – 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

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

Client-Server applications

[email protected]

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

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

Client-Server applications

[email protected]

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

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

Client-Server applications

[email protected]

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

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

Client-Server applications

[email protected]

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!]

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

Client-Server applications

[email protected]

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)

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

Client-Server applications

[email protected]

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.

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

Client-Server applications

[email protected]

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 overview

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

Client-Server applications

[email protected]

Practical notesYou need to compile the .java files on the schedule

into a .class fileNeed a HTML to call the .class files

Applets have no main method and so cannot run on their own

Two examples follow to demonstrateFree Applets out on the web but beware!

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

Client-Server applications

[email protected]

HTML wrapper

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

Client-Server applications

[email protected]

Examples running

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

Client-Server applications

[email protected]

HTML wrapper

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

Client-Server applications

[email protected]

Examples running