New features in DWR 0.8
DWR version 0.8 contains a big list of new features. You can download version 0.8 from java.net. The change log looks like this:
-
Batch sending of remote calls:
DWR will now send a group of remote calls together in a single batch to reduce network latency. SeeDWREngine.beginBatch()
andDWREngine.endBatch()
for more information. -
Provision of call ordering promises:
DWR can return results in the order in which they were sent usingDWREngine.setOrdered()
. Warning: Setting this to true will slow down your application, and it expose you to timeouts if a message gets lost. In addition and it may well mean that you are being lazy and not thinking about the asynchronous model properly. -
Fine grained access control:
You can now specify exactly which methods are allowed and disallowed using the include and exclude elements in dwr.xml:<create creator="new" javascript="JDate" class="java.util.Date"> <include method="getSeconds"/> <include method="getMinutes"/> </create>
The alternative is to<exclude .../>
. You can do one or the other but not both. -
J2EE role based authorization:
You can now specify that certain methods are only available to users with certain roles:<create creator="new" javascript="JDate" class="java.util.Date"> <auth method="toString" role="devel"/> </create>
This requires you to have added J2EE security turned on in your web.xml. -
Methods on java.lang.Object (like
wait()
) are now disallowed. -
Enhanced debug pages:
The debug pages athttp://localhost:8080/[YOUR-WEB-APP]/dwr
have been enhanced to allow you to enter parameters other than strings, to show more detail on returned objects and to give more feedback on why methods are unavailable.
-
Auto-fill of Servlet Spec parameters:
If you have a DWR remoted method that has an HttpServletRequest parameter then DWR will automatically fill it in for you. This gives you a way of accessing HttpServletRequest like ExecutionContext except that you don't get the dependency on DWR. It also works for HttpServletResponse etc. -
Logging is now fine grained, and there is more of it:
If you were turning DWR debug on globally, you probably don't want to any more! -
You can specify detailed type information for collections:
List, Set etc don't have type info (and even under 1.5 it seems you can't get at it) so you can specify the types in dwr.xml:<create creator="new" javascript="Test" class="uk.ltd.getahead.testdwr.Test"> <parameter method="testBeanSetParam" number="0" type="uk.ltd.getahead.testdwr.TestBean"/> </create>
This solution is not perfect, and there is an update planned post 1.0
We are working on a smaller list for the next version so we are not that far from 1.0.
Update: Make that 0.8.1; there was an annoying Javascript error as a result of me fixing some issues brought up by a Javascript lint program. That'll teach me to use lint.
Comments
Comments have been turned off on old posts