Direct Web Remoting
Original authorJoe Walker
DeveloperDavid Marginian / Dojo Foundation
ReleaseAugust 29, 2005; 20 years ago (2005-08-29)
Stable release
3.0.2 / December 11, 2016; 9 years ago (2016-12-11)
Written inJava and JavaScript
Operating systemCross-platform
Size1.08 MB (archived)
TypeAjax technology
LicenseApache 2.0 Licence
Websitedirectwebremoting.org Edit this at Wikidata
Repository

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.

Application

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

edit
  1. ^ Carneiro Jr., Cloves (June 20, 2005). "AJAX made simple with DWR". JavaWorld. Retrieved 2020-08-06.
  2. ^ a b Overview of DWR, retrieved 2008-06-24

Bibliography

edit
edit

📚 Artikel Terkait di Wikipedia

DWR

Robertson Jr. (1914–1992), American medieval literature scholar Direct Web Remoting, a Java open source library Durable water repellent, a type of fabric

Java (programming language)

network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular

Index of JavaScript-related articles

CssQuery Cytoscape D3.js Dart (programming language) DaVinci (software) Direct Web Remoting Document Update Markup Language DocumentCloud Dojo Toolkit Douglas

List of Ajax frameworks

development AribaWeb an open-source framework with reflection and object-relational mapping DWR Direct Web Remoting Echo for Ajax servlets Google Web Toolkit a

Google Guava

10,000 GitHub projects found that Google-made libraries, such as Google Web Toolkit and Guava, constituted 7 of the top 100 most popular libraries in

List of JVM languages

stats are included under Clojure, and it's an implementation targeting the web with JavaScript, not the JVM.) Python is TIOBE's top language; Jython, its

World Wide Web

web can be located and accessed by a direct URL or IP address and may require a password or other security access past the public website page. A web

Aptana

functions typical of web application servers. Jaxer also provides for access to Java objects via the open source Direct Web Remoting project. Jaxer is now