dwr direct web remoting
TRANSCRIPT
![Page 1: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/1.jpg)
DWR - Direct Web Remoting
Subramanian Thiruppathi
![Page 2: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/2.jpg)
Agenda
Introduction
Step by Step
DWR Demo
Reference
![Page 3: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/3.jpg)
DWR
DWR is a Java library that enables Java on the server and JavaScript in a browser to interact and call each other as simply as possible.
DWR is Easy Ajax for Java DWR is Open Source, available under the Apache
Software License v2 DWR provides integration with Dojo and Spring etc., Version
– Latest Version: 3.0.rc1– Current stable release: 2.0
![Page 4: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/4.jpg)
Who is using DWR
Bank of America Citigroup Deutschebank Permanent General Dow Jones RSA Security Cap Gemini The International Olympic Committee, IBM in the US, China and India Caterpillar 20th Century Fox UCG Lufthansa
![Page 5: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/5.jpg)
DWR Developers
![Page 6: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/6.jpg)
DWR
JavaScript running in the browser that sends requests and can dynamically update the webpage.
![Page 7: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/7.jpg)
Reverse Ajax (available since DWR version 2.0)
A Java Servlet running on the server that processes requests and sends responses back to the browser.
![Page 8: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/8.jpg)
Step By Step – DWRSample
![Page 9: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/9.jpg)
Step By Step – Web.xml
![Page 10: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/10.jpg)
Step By Step – Factorial
![Page 11: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/11.jpg)
Step By Step – dwr.xml
![Page 12: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/12.jpg)
Step By Step – Test DWR
![Page 13: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/13.jpg)
Step By Step – ex1.html
engine.js: Handles all server communication util.js: Helps you alter web pages with the
data you got from the server
![Page 14: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/14.jpg)
Step By Step – ex1.js
![Page 15: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/15.jpg)
Step By Step – Done !!!!
![Page 16: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/16.jpg)
Step By Step – JFactorial.js (Dynamic JS)
![Page 17: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/17.jpg)
More info - DWR
More than one remote calls use batch
dwr.engine.beginBatch();Remote.method1(params, callback1);Remote.method2(params, callback2);dwr.engine.endBatch();
Dwr.xml
<allow> <create creator="..." javascript="..." scope="...">
<param name="..." value="..."/> <auth method="..." role="..."/> <exclude method="..."/> <include method="..."/>
</create></allow>
![Page 18: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/18.jpg)
More info - DWR
Dwr.xml<allow>
<create creator="..." javascript="..." scope="..."> <param name="..." value="..."/> <exclude method="..."/> <include method="..."/>
</create></allow>
The creator attributes specifies how DWR creates a Java object. It can be : New - This uses the java obejcts new operator. This is very commonly used None – it does not create any object. This assumes that the object has already been created
by someone else or the method to be called static Scripted – It uses a scripting language to create objects like BSF (Bean Scripting Framework)
or BeanShell Spring – It uses Spring framework to give accesses to a Java Object Jsf – it enables JSF managed beans to be remoted Struts – It enables Struts FormBeans as remoted objects. Pageflow – it gives accesses to weblogic / Beehive PageFlow Objects.
![Page 19: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/19.jpg)
More info - DWR
Dwr.xml<allow>
<create creator="..." javascript="..." scope="..."> <param name="..." value="..."/> <exclude method="..."/> <include method="..."/>
</create></allow>
The javascript attributes gives the Java object name that is used in the browser side. The scope element is used to specify where a bean is available. It can be
– Application– Request– Session– Page– Script The first four are the same as in servlet development and script allows a bean to be tied to an ID in a
page rather than an HTTP session cookie.The default scope is page Two elements include and exclude are used to limit access to class methods.
![Page 20: DWR Direct Web Remoting](https://reader035.vdocument.in/reader035/viewer/2022071814/55a505a91a28ab516f8b456d/html5/thumbnails/20.jpg)
Reference
http://directwebremoting.org/