How is Javascript code generated in Direct Web Remoting (DWR)?

How exactly is Javascript code generated in Direct Web Remoting (DWR)? I have gone through the official site as well as other sources ( and understand there are 3 JS files.

But my question is; how is the JS generated and is it possible to make changes/customize any of the functions? If yes, how?

Thank you.



You can examine these files for better understanding, but they're meant to behave as plumbing. It would be better for maintainability if you kept your custom code separate.

The 'engine.js' and 'util.js' files are inside the DWR jar, in the folder: org/directwebremoting. The engine.js file contains some ${...} variables that are replaced by the servlet before the file is sent to the browser. The util.js file contains no such variables.

The interface files are more complicated. I have never needed to make changes or customize these (which is good design on DWRs part actually). My guess is that the interface based js file(s) are generated by what you configure in dwr.xml and DWR's use of the reflection API to read the Java helper class and generate a Javascript-stub to map to it. You can view these file(s) by pasting the URL from your <script src=".../dwr/interface/filename.js"> into a different browser tab.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.