« Return to Thread: Spring - DWR little contribution

Re: Spring - DWR little contribution

by Hani Suleiman :: Rate this Message:

Reply to Author | View in Thread

Hi Jose,

Great start!

Just one thing (correct me if I'm wrong...) but why do you need to do  
any scanning yourself in DwrServicePostProcessor? I think this isnt  
the job of dwr (or any dwr extension) as its the role of the spring  
container. So without it, people can list their beans explicitly in  
xml and still use dwr annotations. Also, if you're using spring with  
annotations chances are you're already using bean auto-discovery, so  
the dwr post processor should just process the beans registered in  
spring, rather than try to discover them.

I'd also suggest that DwrService take a name parameter (instead of  
javascript) as that's a bit clearer, as well as removing the spring  
specific @Component annotation from it.

On Jan 22, 2008, at 11:07 AM, Jose Noheda wrote:

> Hi,
>
> It seems a lot of people still have problems configuring DWR inside  
> Spring. Looking for a way to improve it I tried to mix annotations  
> with Spring. This is the result.
>
> The code needs to be polished a lot (consider it a proof-of-concept  
> as always). Basically, you only have to define this beans in the XML:
>
> <dwr:configuration />
> <dwr:controller id="dwrController" />
> <bean class="org.directwebremoting.spring.DwrServicePostProcessor"  
> p:basePackages="..." />
> <bean class=" org.directwebremoting.spring.DwrHandlerMapping" />
>
> And it will automatically remote any spring beans annotated with  
> DwrService / RemoteMethod. I think it's a good start.
>
> Next steps involve:
>
> * Extending the schema. Something like <dwr:annotation-configured /
> >. I didn't want to mess with DWR code if at all possible. Adding it  
> should be pretty straightforward.
> * Refactoring (it shares some code with DwrNamespaceHandler)
> * Add some convention with package names and bypass the basePackages  
> property (I tried it but Package.getPackages() keep forgetting the  
> WEB-INF/classes packages for some reason beyond my knowledge)
> * Getting a little help from SpringSource so we don't need to extend  
> some classes. Good extension points in  
> ClassPathBeanDefinitionScanner would save us lots of trouble
>
> Comments are welcomed!
>
> Regards,
> <
> RemotedBean
> .java
> >
> <
> DwrHandlerMapping
> .java
> >
> <
> DwrService
> .java
> ><DwrServicePostProcessor.java><DwrServiceScanner.java><dispatcher-
> servlet
> .xml
> >
> <
> web
> .xml
> >
> <
> index
> .jsp
> >---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: Spring - DWR little contribution