Home
JavaEE
Java GUI
Framework
DHtml
Android
插画
教程下载

ATOM 2.0   RSS 2.0
Add to iGoogle Add to Live.com
  • DeZender对用Zend Encoder加密过的PHP文件反编译
  • 写一个用于微博同步的Google Desktop Gadget
  • 在同学的QZone中看到的BB用药大全
  • 今天终于收到金山快盘的邀请码
  • 利用最短ie判断在不同浏览器上播放背景音乐
  • 对插画方面的一点感受与回忆
  • 网上看到的两个死里逃生的图片,记录一下
  • 今天开通了糖果社区,附几个激活码
  • 终于可以实现我的多个微博实时同步了
  • 备案和现场拍照就是对站长们的瞎折腾
  • 今天开通了糖果社区,附几个激活码
  • 终于可以实现我的多个微博实时同步了
  • 备案和现场拍照就是对站长们的瞎折腾
  • 昨天借用飞姐的佳作做的一个浪漫爱情网页
  • 有几个腾讯微博的邀请码(实时更新)
  • BB的网站移到了GAE-JAVA上了
  • 一个基于GAE Python Web.py和JQuery的留言本程序
  • 类许愿墙的一个告白网站和一个电子书网站
  • Android中用Bitmap获取图片中某个区域的图象
  • 对暴力破解带密码的QQ相册的可行性分析
  • 对淘宝web旺旺版一些通讯接口的研究

dwr配置Configuring

posted by David Chen at July 11, 2007, 9:29 AM    

Creating a dwr.xml file
dwr.xml has the following structure:

<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">

<dwr>

<!-- init is only needed if you are extending DWR -->
<init>
<creator id="..." class="..."/>
<converter id="..." class="..."/>
</init>

<!-- without allow, DWR isn't allowed to do anything -->
<allow>
<create creator="..." javascript="..."/>
<convert converter="..." match="..."/>
</allow>

<!-- you may need to tell DWR about method signatures -->
<signatures>
...
</signatures>

</dwr>

Terminology
Some terminology worth understanding - parameters are converted, but the remoted beans are created. So if you have a bean A with a method A.blah(B) then you need a creator for A and a converter for B.

<allow>
The allow section defines which classes DWR can create and convert.

Creators
Each class on which we execute methods, needs a <create ...> entry. There are several types of creator. The most common ones use either the 'new' keyword or the Spring framework. For more information, see the Creator documentation.

Converters
We need to ensure that all the parameters can be converted. Many of the types provided by the JDK are enabled for you, but you need to give DWR permission to convert your own code. Generally this means that JavaBean parameters will need a <convert ...> entry.

By default all of the following are converted for you without further declaration:

· All primitive types, boolean, int, double, etc.

· The Class based versions of the these Boolean, Integer, etc.

· java.lang.String

· java.util.Date and the 3 SQL derivatives

· arrays of the above

· Collections (Lists, Sets, Maps, Iterators, etc) of the above

· DOM objects (like Element and Document) from DOM, XOM, JDOM and DOM4J

For details on how to convert your own JavaBeans and other parameters see the Converter documentation.

<init>
The optional init section declares the classes that can be used to create beans to remote and the classes that can be used to convert beans in the marshalling process. For most cases you will not need to use it. If you wish to define a new Creator [JavaDoc] or Converter [JavaDoc] it needs to be declared here, but do double-check on the ones that are currently available first.

Having an entry in the init section just tells DWR about the existence of the class and gives it some basic detail about how it works. It does not bring it into use. In this way it is a bit like an import statement in Java. Most classes must be imported before use, but just having an import does not mean that the class is being used. Each creator and converter has an id attribute to allow it to be referred to later on.

<signatures>
DWR uses reflection to find out what types it should use in the conversion process. Sometimes the type information is not available, in which case you can type the method signatures in here to give it a hint. See the signatures section for more detail.

Multiple dwr.xml Files
There can be more than one dwr.xml file (see the web.xml documentation for more details). The entries in each are added together. This ability is used by DWR to load the basic config file to get everyone started.
We can get a good introduction to dwr.xml files by looking at the standard config file that everyone gets for free.
Labels:
Trackback:   http://cwq.iou1314.com/_a148
微博最近更新
[2010-09-06 16:08]    明天有市领导来,后天又有省领导来,今天一个下午就拉了5条大横幅,累死我了,上周星期6,7办公室都要上班,这种生活什么时候可以摆脱?
[2010-09-04 04:43]    又是要加班的双休日,昨晚和领导去县城做资料做到11:30,确定这两天都要加班,刚准备回家,跟着领导接 电话说有村民想自杀不成,已带到卫生院,又跟领导回乡镇处理劝说一下。搞完到了1:30。回来凉都冲就睡 觉了。
本站内的任何文章,只代表个人意见或学习所用,如有版权声明,请尊重作者的劳动成果,在转载时请保留原始链接并注明出处。
Power by David's PhpCms, © 2007 - 2010 CWQ.IOU1314.COM All Rights Reserved.