BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

DWR 2.0 Adds Reverse Ajax, Script Scope, and Annotation Support

| by Scott Delap Follow 0 Followers on Apr 26, 2007. Estimated reading time: 1 minute |
The DWR team has released version 2.0. DWR allows Javascript in a browser to interact with Java on a server. Version 2.0 adds a number of interesting features. Among the highlights from the press release:

Javascript Proxy API

DWR can dynamically generate JavaScript from a Java API. This is done at runtime rather than compile time, so we can use it to remote control many browsers. This makes it very easy to write things like chat applications, or anything particularly dynamic.

Reverse Ajax

DWR supports 3 ways to asynchronously transfer messages from the server to the browser: Comet (long-lived HTTP connections), Polling and Piggyback. Of these Comet and Polling are active (fast but require extra network traffic) and Piggyback is passive (slower but doesn't need extra network traffic). DWR automatically selects the best method transparently to the programmer.

Script Scope

With normal servlets there are 4 scopes; application, session, page and request. DWR2 introduces a new scope: 'script'. Script scope applies to a single web page (rather than a whole browser), however long the page lives.

Annotations

If you are using Java 5 then you can make use of the new DWR annotations. New annotations include @RemoteProxy, @DataTransferObject, @RemoteMethod and @RemoteProperty.

DWR 2 also includes security features to provide automatic protection against CSRF attacks for many configurations and defaults to a mode where XSS attacks are reduced.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT