Direct Web Remoting

Short description: Java web framework

Direct Web RemotingOriginal author(s)| Joe Walker

|

Developer(s)| David Marginian / Dojo Foundation
Initial release| August 29, 2005; 20 years ago (2005-08-29)
Stable release|

3.0.2 / December 11, 2016; 9 years ago (2016-12-11)

Written in| Java and JavaScript
Operating system| Cross-platform
Size| 1.08 MB (archived)
Type| Ajax technology
License| Apache 2.0 Licence
Website| {{{1}}}

Direct Web Remoting, or DWR, is a Java open-source library that helps developers write web sites that include Ajax technology.[1] It allows code in a web browser to use Java functions running on a web server as if those functions were within the browser. The DWR project was started by Joe Walker in 2004, 1.0 released at August 29, 2005.

## Contents

* 1 Application
* 2 References
* 3 Bibliography
* 4 External links

## Application

* Code to allow JavaScript to retrieve data from a servlet-based web server using Ajax principles.
* A JavaScript library that makes it easier for the website developer to dynamically update the web page with the retrieved data.

DWR takes a novel approach to Ajax by dynamically generating JavaScript code based on Java classes.[2] Thus the web developer can use Java code from JavaScript as if it were local to the web browser; whereas in reality the Java code runs in the web server and has full access to web server resources. For security reasons the web developer must configure exactly which Java classes are safe to export (which is often called web.xml or dwr.xml).

This method of remoting functions from Java to JavaScript gives DWR users a feel much like conventional RPC mechanisms like RMI or SOAP, with the benefit that it runs over the web without requiring web browser plug-ins.

DWR does not consider the web browser / web server protocol to be important, and prefers to ensure that the programmer's interface is natural. The greatest challenge to this is to marry the asynchronous nature of Ajax with the synchronous nature of normal Java method calls.

In the asynchronous model, result data is only available some time after the initial call is made. DWR solves this problem by allowing the web developer to specify a function to be called when the data is returned using an extra method parameter. This extra method is called CallBack Method. The value returned from the java function will be passed to the callback method.

Here is a sample Callback:

MJavaClassOnJs.getListProducts(selectedCategory,{
callback:function(returnedList){
dwr.util.addOptions(myComboId,returnedList,"productId","productName")

The callback is that function inside the JSON object passed as an additional parameter to the remoted function.

With version 2.0, DWR supports Comet (also called "Reverse Ajax)[2] where Java code running on the server can deliberately send dedicated JavaScript to a browser.

## References

1. ↑ Carneiro Jr., Cloves (2005-06-20). "AJAX made simple with DWR". JavaWorld. https://www.infoworld.com/article/2071890/ajax-made-simple-with-dwr.html. Retrieved 2020-08-06.
2. ↑ 2.0 2.1 Overview of DWR, http://directwebremoting.org/dwr/introduction/index.html, retrieved 2008-06-24

## Bibliography

* Zammetti, Frank (January 25, 2008), Practical DWR 2 Projects (1st ed.), Apress, pp. 540, doi:10.1007/978-1-4302-0556-2, ISBN 978-1-59059-941-9

## External links

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Direct Web Remoting. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:Direct_Web_Remoting&oldid=539157"