Issue Details (XML | Word | Printable)

Key: DWR-223
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jose Noheda
Reporter: Josh Kalderimis
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DWR

DWR Namespace bean reference

Created: 26/Feb/08 02:16 AM   Updated: 27/Feb/08 10:59 AM   Resolved: 27/Feb/08 10:59 AM
Component/s: spring
Affects Version/s: 2.0.2
Fix Version/s: 3.0.RC1


 Description  « Hide
Hi,

The current namespace Spring integration does not play nicely with multi-modular projects where service bean definitions might reside in a different file which can not be modified.

Can you please look at adding an extra attribute to the dwr:remote tag (eg. bean-ref) which allows the bean id to be passed in, thus allowing the dwr:remote tag to reside in a separate file. eg.

(applicationContext-services.xml)
<bean id="simpleService" class="nz.co.curlybrackets.tutorial.newspringmvc.services.SimpleServiceImpl">
   <property name="simpleRepository" ref="aSimpleRepository"/>
   <property name="emailService" ref="anEmailService"/>
   <property name="importantThing" ref="anImportantThing"/>
</bean>

(applicationContext-dwr.xml)
<dwr:remote bean-ref="myServiceBean" javascript="myAjaxService">
     <dwr:include method="*"/>
</dwr:remote>

Currently I acheive this by using Spring proxies eg.
<bean id="mySimpleService" class="org.springframework.aop.framework.ProxyFactoryBean">
   <property name="proxyInterfaces" value="nz.co.curlybrackets.tutorial.services.SimpleService"/>
   <property name="target" ref="simpleService"/>
   <dwr:remote javascript="MySimpleAjaxService" />
</bean>

This would also reduce pollution of bean definitions and promote separation of concerns.

Thanks

http://developingdeveloper.wordpress.com/2008/02/16/spring-dwr-namespaces-aop/

Sort Order: Ascending order - Click to sort in descending order
Jose Noheda added a comment - 27/Feb/08 10:59 AM
Adds a new tag

<bean id="oneBean" class="..." />

<dwr:proxy-ref bean="oneBean" javascript="...">
   <dwr:include method="..." /> // Or exclude
</dwr:proxy-ref>

It allows the namespace handler to remote a bean outside the bean definition, even in other context, as long as the context is reachable (in a parent-child hierarchy)