Announcement Announcement Module
No announcement yet.
DwrController problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DwrController problem

    I am trying to use DWR with Spring 2.5.6, and I cannot get DWR to vend /dwr/engine.js and its related JavaScript files. In fact, I ended up putting a breakpoint in DispatchServlet, and the attempt to get /dwr/engine.js raised an exception with message:

    No adapter for handler [[email protected]]: Does your handler implement a supported interface like Controller?
    DwrController extends Spring's AbstractController, which implements Controller, and so I am badly confused.

  • #2
    Missing Handler


    you have to add a DefaultHandler like:
    <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
    Here's a sample context:
    <!-- 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">
    	    <prop key="/engine.js">dwrController</prop>
    	    <prop key="/util.js">dwrController</prop>
    	    <prop key="/call/**">dwrController</prop>
    	    <prop key="/interface/**">dwrController</prop>
        <!-- mandatory  -->
        <dwr:controller id="dwrController" debug="true" />
        <!-- mandatory too, can be empty -->
        <!-- dem Spring-Context stehen. -->        
        <!-- 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: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
    Last edited by banzai1972; Sep 15th, 2010, 08:10 AM. Reason: wrong url