service side ajax

10
Service Side Ajax Richard Schmidt hangstrap @ gmail . Com Metservice

Upload: parson

Post on 05-Jan-2016

35 views

Category:

Documents


0 download

DESCRIPTION

Richard Schmidt hangstrap @ gmail . Com Metservice. Service Side Ajax. Our Situation / Requirement. Rich(ish) Application. Easy to deploy / standard browser. Not many users. Max 50 sessions Very little concurrency Hardware costs are not important. Main cost is developer salaries. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Service Side Ajax

Service Side Ajax

Richard Schmidthangstrap @ gmail . Com

Metservice

Page 2: Service Side Ajax

Our Situation / Requirement

Rich(ish) Application. Easy to deploy / standard browser. Not many users.

Max 50 sessions Very little concurrency

Hardware costs are not important. Main cost is developer salaries.

Page 3: Service Side Ajax

Some Web Frameworks

JSF (yea right!) Ajax?

Tapestry, Wicket Component based.

Flex Another language

GWT Scaled down Java

Java client (applet / web start) Will the client have JAVA installed?

Something else?

Page 4: Service Side Ajax

Server Side Ajax

Server downloads a javascript app. to browser.

Server then sends list of components that javascript app. renders in the browser.

User events are sent back to server using Ajax.

Server processes events and then send changes to components back to client...

Page 5: Service Side Ajax

Advantages

Only one language Can use full features of Java

not like GWT No writing of HTML or Javascript! Write using components that fire events.

Swing like. KISS: One less physical layer All code runs on one VM, easier to debug,

test etc.

Page 6: Service Side Ajax

Disadvantages

Each user has a large session variable. Not going to work for Google!

More network traffic to / from server. (but not much more!)

Not mainstream technology. 'Stuck' with the basic components supplied by

the framework. Set of components – still have to write a

application framework! Different browsers.

Page 7: Service Side Ajax

Players

Thinwire Stable, not much development.

Echo2/3 Well known.

Wing-S Based on Swing components.

J-Seamless Uses Flex as a renderer.

ULC Canoo Commercial, Java proxy on client Test framework, visual editor, support, rich

functionality.

Page 8: Service Side Ajax

public static void main(String[] args) { //Create and set initial position for components final Dialog dialog = new Dialog("Hello World, ThinWire Style!"); Label label = new Label("Hello, what is your name?"); final TextField input = new TextField(); Button button = new Button("Ok"); //When button is clicked, close modal dialog and say hello button.addActionListener("click", new ActionListener() { public void actionPerformed(ActionEvent ev) { MessageBox.confirm("Hello " + input.getText() + "!"); dialog.setVisible(false); } });

//Add components to dialog dialog.getChildren().add(label); dialog.getChildren().add(input); dialog.getChildren().add(button); //Show dialog and wait for "OK" press dialog.setVisible(true); }

Code Example

Page 9: Service Side Ajax

Using Beans Binding

ATestBean bean = new ATestBean();Property<ATestBean, Boolean> pt1Client = BeanProperty.create("enabled");

TextField tf = new TextField();Property<TextField, Boolean> tfProp = BeanProperty.create("enabled");

Binding<ATestBean, Boolean, TextField, Boolean> binding = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE,

bean, pt1Client, tf, tfProp);

binding.bind();

Page 10: Service Side Ajax

Demos

Echo2 Wing-S Canoo ULC Our App