client-server applications introduction to java applets client-server architectures why do applets...

Post on 18-Jan-2018

251 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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)‏

TRANSCRIPT

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

Client-Server applications

N.A.Shulver@staffs.ac.uk

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”

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)

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

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

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

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

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

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

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)

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.

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 overview

Client-Server applications

N.A.Shulver@staffs.ac.uk

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!

Client-Server applications

N.A.Shulver@staffs.ac.uk

HTML wrapper

Client-Server applications

N.A.Shulver@staffs.ac.uk

Examples running

Client-Server applications

N.A.Shulver@staffs.ac.uk

HTML wrapper

Client-Server applications

N.A.Shulver@staffs.ac.uk

Examples running

top related