Hi,
you have to add a DefaultHandler like:
Code:
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
Here's a sample context:
Code:
<!-- DefaultHandlerAdapter -->
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
<!-- Url-Mapping for DWR. -->
<!-- wep_appname/contexRoot/engine.js -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/engine.js">dwrController</prop>
<prop key="/util.js">dwrController</prop>
<prop key="/call/**">dwrController</prop>
<prop key="/interface/**">dwrController</prop>
</props>
</property>
</bean>
<!-- mandatory -->
<dwr:controller id="dwrController" debug="true" />
<!-- mandatory too, can be empty -->
<!-- dem Spring-Context stehen. -->
<dwr:configuration/>
<!-- Sample-DWR-Remote -->
<bean id="dwrService" class="net.yourPackage.YourRemoteClass">
<dwr:remote javascript="YourDWRServiceName">
<dwr:include method="exposedMethod" />
<dwr:convert type="bean" class="net.yourpage.AnotherTypeReturnedByYourService" />
<dwr:convert type="exception" class="java.lang.Exception"/>
<dwr:convert type="bean" class="java.lang.StackTraceElement"/>
</dwr:remote>
</bean>
Annotation:
- dwr:configuration:
You can use this bean for dws:remote-entries. But then you have no spring-di in your remoteController. - urlMapping:
Internally the DwrController looks for path (without context-path) beginning with /engine.js, /call/... So, if you have a path something like /dwr/engine.js (or webapp_name/aContextPath/dwr/engine.js) the DwrController cant find this in his own map. - Use exception-handling carefully (for security reasons)
Another, and better solution, can be found here
Best Regard
michael