140 likes | 246 Views
Rajesh R rajeshranganathan@cevalsoft.com. DWR: Direct Web Remoting. DWR:Agenda. What is DWR? Why DWR? Reverse AJAX Advantages. What is DWR?. Is a Java and JavaScript open source library which allows you to write Ajax web applications Specifically designed with Java technology in mind
E N D
Rajesh R rajeshranganathan@cevalsoft.com DWR: Direct Web Remoting
DWR:Agenda What is DWR? Why DWR? Reverse AJAX Advantages
What is DWR? Is a Java and JavaScript open source library which allows you to write Ajax web applications Specifically designed with Java technology in mind > “Easy AJAX for Java” Allows JavaScript code in a browser to use Java methods running on a web server just as if they were in the browser > Why it is called “Direct remoting”
Why DWR? Without DWR, you would have to create many Web application endpoints (servlets) that need to be address'able via URI's What happens if you have several methods in a class on the server that you want to invoke from the browser? > Each of these methods need to be addressable via URI whether you are using XMLHttpRequest directory or client side only toolkit such as Dojo or Prototype > You would have to map parameters and return values to HTML input form parameters and responses yourself DWR comes with some JavaScript utility functions
Ingredients A Java Servlet running on the server that processes incoming DWR requests and sends responses back to the browser. JavaScript running in the browser that sends requests and can dynamically update the webpage
Reverse Ajax • Reverse Ajax is the biggest new feature in DWR 2.0 • It gives you the ability to asynchronously send data from a web-server to a browser.
Java to JS: Reverse Ajax • allows Java code running on the server to find out what clients are viewing certain pages, and to send to them JavaScript, generated either manually or using a Java API
Dynamic JS DWR generates dynamic JS based on the Java Classes The DWR Engine then does some Ajax magic to make it feel like the execution is happening on the browser, but in reality the server is executing the code and DWR is marshalling the data back and forwards.
Advantages • Call Java Functions like RMI or Soap • Automatically create Java versions of JS • Expose business methods through JS
Supported Environment • DWR requires JDK1.3 or later • Tomcat • Weblogic • Websphere • Jboss • Etc…
Browser Support Firefox 1.0 and above Internet Explorer 6.0 and above Opera 8.0 and above Safari 1.3 and above
Thanks! Rajesh