DWR 2 and Spring 2

View: New views
9 Messages — Rating Filter:   Alert me  

DWR 2 and Spring 2

by Lexius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does anyone have any working example
configs?

...
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
...


<dwr:controller id="dwrController" debug="true" />
    <dwr:configuration>
.....


?

Re: DWR 2 and Spring 2

by Brendan Grainger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Try this:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop " xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr "
    xsi:schemaLocation="
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
               http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd"
               default-lazy-init="false"
               >

    <!--  AJAX Facades -->
    <dwr:configuration>

        <dwr:convert type="bean" class="org.directwebremoting.spring.TestIncludesBean"  >
            <dwr:include method="includedProperty" />
        </dwr:convert>
       
        <dwr:convert type="bean" class="org.directwebremoting.spring.TestExcludesBean"  >
            <dwr:exclude method="excludedProperty" />
        </dwr:convert>
        
         <dwr:convert type="bean" class="org.directwebremoting.spring.Check" />
        
    </dwr:configuration>

</beans>

I am using the DWR and Spring Namespace integration successfully so let me know if you need anything more.

HTH
Brendan

On 12/16/06, Lexius <lexius.info@...> wrote:

Does anyone have any working example
configs?

...
xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
...


<dwr:controller id="dwrController" debug="true" />
    <dwr:configuration>
.....


?
--
View this message in context: http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7907311
Sent from the DWR - Users mailing list archive at Nabble.com.

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



Re: DWR 2 and Spring 2

by Lexius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Brendan Grainger-2 wrote:
Hi,

Try this:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="
http://www.springframework.org/schema/tx"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    xsi:schemaLocation="
               http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
               http://www.directwebremoting.org/schema/spring-dwr
http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd"
               default-lazy-init="false"
               >

    <!--  AJAX Facades -->
    <dwr:configuration>

        <dwr:convert type="bean" class="
org.directwebremoting.spring.TestIncludesBean"  >
            <dwr:include method="includedProperty" />
        </dwr:convert>

        <dwr:convert type="bean" class="
org.directwebremoting.spring.TestExcludesBean"  >
            <dwr:exclude method="excludedProperty" />
        </dwr:convert>

         <dwr:convert type="bean" class="org.directwebremoting.spring.Check"
/>

    </dwr:configuration>

</beans>

I am using the DWR and Spring Namespace integration successfully so let me
know if you need anything more.

HTH
Brendan

On 12/16/06, Lexius <lexius.info@gmail.com> wrote:
>
>
> Does anyone have any working example
> configs?
>
> ...
> xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
> http://www.directwebremoting.org/schema/spring-dwr
> http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
> ...
>
>
> <dwr:controller id="dwrController" debug="true" />
>     <dwr:configuration>
> .....
>
>
> ?
> --
> View this message in context:
> http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7907311
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>
>
Thanks for reply.
Can you show me:

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
....
<servlet-mapping> for Spring in web.xml
...
and how to use <dwr:remote javascript=""

My config not working for me :(

Re: DWR 2 and Spring 2

by Brendan Grainger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sure, I'm assuming you have spring MVC working.

I have this in my springDispatcher-servlet.xml (or something similar).

    <bean id="ajaxService" class="com.yourpackage.YourService">
        <dwr:remote javascript="ajaxServiceNameInJavascript">
            <dwr:include method="getAllEntries" />
            <dwr:include method="getAllCategories" />
        </dwr:remote>
        <property name="someProperty" ref="propertyRef" />
    </bean>

I have something like this in my web.xml:

    <servlet>
        <servlet-name>springDispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- For regular spring controllers -->
    <servlet-mapping>
        <servlet-name>springDispatcher</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!-- Needed for dwr -->
    <servlet-mapping>
        <servlet-name>springDispatcher</servlet-name>
        <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>

HTH
Brendan


On 12/16/06, Lexius <lexius.info@...> wrote:



Brendan Grainger-2 wrote:

>
> Hi,
>
> Try this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns=" http://www.springframework.org/schema/beans" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:aop=" http://www.springframework.org/schema/aop" xmlns:tx="
> http://www.springframework.org/schema/tx"
>     xmlns:dwr=" http://www.directwebremoting.org/schema/spring-dwr"
>     xsi:schemaLocation="
>                http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>                 http://www.directwebremoting.org/schema/spring-dwr
> http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd"
>                default-lazy-init="false"
>                >
>
>     <!--  AJAX Facades -->
>     <dwr:configuration>
>
>         <dwr:convert type="bean" class="
> org.directwebremoting.spring.TestIncludesBean "  >
>             <dwr:include method="includedProperty" />
>         </dwr:convert>
>
>         <dwr:convert type="bean" class="
> org.directwebremoting.spring.TestExcludesBean "  >
>             <dwr:exclude method="excludedProperty" />
>         </dwr:convert>
>
>          <dwr:convert type="bean"
> class="org.directwebremoting.spring.Check "
> />
>
>     </dwr:configuration>
>
> </beans>
>
> I am using the DWR and Spring Namespace integration successfully so let me
> know if you need anything more.
>
> HTH
> Brendan
>
> On 12/16/06, Lexius <lexius.info@...> wrote:
>>
>>
>> Does anyone have any working example
>> configs?
>>
>> ...
>> xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
>> http://www.directwebremoting.org/schema/spring-dwr
>> http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
>> ...
>>
>>
>> <dwr:controller id="dwrController" debug="true" />
>>     <dwr:configuration>
>> .....
>>
>>
>> ?
>> --
>> View this message in context:
>> http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7907311
>> Sent from the DWR - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>

Thanks for reply.
Can you show me:

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
....
<servlet-mapping> for Spring in web.xml
...
and how to use <dwr:remote javascript=""

My config not working for me :(
--
View this message in context: http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7907637
Sent from the DWR - Users mailing list archive at Nabble.com.

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



Re: DWR 2 and Spring 2

by Lexius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Brendan Grainger-2 wrote:
Sure, I'm assuming you have spring MVC working.

I have this in my springDispatcher-servlet.xml (or something similar).
...
Thanks.
Now it work for me. The problem was in url mapping:

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        ...
        <property name="mappings">
            <props>
                <prop key="/test.html">testController</prop>
                <prop key="/flowController.html">flowController</prop>
                <prop key="/*">dwrController</prop>
            </props>
        </property>

    </bean>

But I don't know how to map dwrController to one url. I get it working only for /* mapping.
Can you help me?

(Sorry for my English, I am from Ukraine)

Re: DWR 2 and Spring 2

by Brendan Grainger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

This is actually a bit of a gotcha I think. Anyway, by default Springs SimpleUrlHandlerMapping sets alwaysUseFullPath to false and in our web.xml we've mapped /dwr/* to the spring dispatcher servlet (someone please correct me if I'm wrong). So the pattern that gets passed to SimpleUrlHandlerMapping by spring is the bit _after_ /dwr. By making the dwrController match everything request that falls through the mappings you've defined you're catching it but you might not want that in general eh?

Anyway, if you set alwaysUseFullPath to false SimpleUrlHandlerMapping you can do something like this:

    <bean id="urlHandlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping ">
        <property name="alwaysUseFullPath" value="true"></property>
        <property name="mappings">
            <props>
...
                <prop key="/dwr/**/*">dwrController</prop>
          </props>
etc

The way I've set it up in spring is to have two SimpleUrlHandlingMapping instances declared. One for regular spring controllers and another for dwr like so:

    <bean id="urlHandlerMapping" class=" org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="/blog/captchaImage.do"> commons.captchaController</prop>
                <prop key="/blog/categoryList.do">weblog.categoriesListController</prop>
...
            </props>
        </property>
    </bean>


    <bean id="dwrHandlerMappings" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="order" value="1" />
        <property name="alwaysUseFullPath" value="true"></property>
        <property name="mappings">
            <props>
                <prop key="/dwr/**/*">dwrController</prop>
            </props>
        </property>
    </bean>

Let me know if that helps.

Brendan





On 12/16/06, Lexius <lexius.info@...> wrote:



Brendan Grainger-2 wrote:
>
> Sure, I'm assuming you have spring MVC working.
>
> I have this in my springDispatcher-servlet.xml (or something similar).
> ...
>

Thanks.
Now it work for me. The problem was in url mapping:

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        ...
        <property name="mappings">
            <props>
                <prop key="/test.html">testController</prop>
                <prop key="/flowController.html">flowController</prop>
                <prop key="/*">dwrController</prop>
            </props>
        </property>

    </bean>

But I don't know how to map dwrController to one url. I get it working only
for /* mapping.
Can you help me?

(Sorry for my English, I am from Ukraine)
--
View this message in context: http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7908369
Sent from the DWR - Users mailing list archive at Nabble.com.

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



Re: DWR 2 and Spring 2

by Lexius :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Brendan Grainger-2 wrote:
Hi,

This is actually a bit of a gotcha I think. Anyway, by default Springs
SimpleUrlHandlerMapping sets alwaysUseFullPath to false and in our
web.xmlwe've mapped /dwr/* to the spring dispatcher servlet (someone
please correct
me if I'm wrong). So the pattern that gets passed to SimpleUrlHandlerMapping
by spring is the bit _after_ /dwr. By making the dwrController match
everything request that falls through the mappings you've defined you're
catching it but you might not want that in general eh?

Anyway, if you set alwaysUseFullPath to false SimpleUrlHandlerMapping you
can do something like this:

    <bean id="urlHandlerMapping" class="
org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="alwaysUseFullPath" value="true"></property>
        <property name="mappings">
            <props>
...
                <prop key="/dwr/**/*">dwrController</prop>
          </props>
etc

The way I've set it up in spring is to have two SimpleUrlHandlingMapping
instances declared. One for regular spring controllers and another for dwr
like so:

    <bean id="urlHandlerMapping" class="
org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="/blog/captchaImage.do">commons.captchaController
</prop>
                <prop key="/blog/categoryList.do">
weblog.categoriesListController</prop>
...
            </props>
        </property>
    </bean>


    <bean id="dwrHandlerMappings" class="
org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="order" value="1" />
        <property name="alwaysUseFullPath" value="true"></property>
        <property name="mappings">
            <props>
                <prop key="/dwr/**/*">dwrController</prop>
            </props>
        </property>
    </bean>

Let me know if that helps.

Brendan





On 12/16/06, Lexius <lexius.info@gmail.com> wrote:
>
>
>
>
> Brendan Grainger-2 wrote:
> >
> > Sure, I'm assuming you have spring MVC working.
> >
> > I have this in my springDispatcher-servlet.xml (or something similar).
> > ...
> >
>
> Thanks.
> Now it work for me. The problem was in url mapping:
>
> <bean id="urlMapping"
> class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
>         ...
>         <property name="mappings">
>             <props>
>                 <prop key="/test.html">testController</prop>
>                 <prop key="/flowController.html">flowController</prop>
>                 <prop key="/*">dwrController</prop>
>             </props>
>         </property>
>
>     </bean>
>
> But I don't know how to map dwrController to one url. I get it working
> only
> for /* mapping.
> Can you help me?
>
> (Sorry for my English, I am from Ukraine)
> --
> View this message in context:
> http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7908369
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>
>
Thanks! Now all working good!

Eugeniy.

Re: DWR 2 and Spring 2

by Alex Shneyderman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

did you see this:

http://bram.jteam.nl/index.php/2006/06/

there is a sample application that has variety of config options one of them is
spring2 and DWR2.



On 12/16/06, Lexius <lexius.info@...> wrote:

>
> Does anyone have any working example
> configs?
>
> ...
> xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
> http://www.directwebremoting.org/schema/spring-dwr
> http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
> ...
>
>
> <dwr:controller id="dwrController" debug="true" />
>     <dwr:configuration>
> .....
>
>
> ?
> --
> View this message in context: http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7907311
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


--
Thanks,
Alex.

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


Re: DWR 2 and Spring 2

by Danny Garcia Hernandez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



My servlet config file look like this.

    <bean id="dwrHandlerMapping"    
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="alwaysUseFullPath" value="true" />  
        <property name="urlMap">
            <map>
              <entry key="/dwr/**/*"><ref local="dwrController"/>
              </entry>                          
            </map>
        </property>
    </bean>      

   <bean id="dwrController"
class="org.directwebremoting.spring.DwrController">
      <property name="configurators">
         <list>
            <ref bean="dwrConfiguration"/>
         </list>
      </property>
      <property name="debug" value="true"/>
   </bean>  
   
   <bean id="dwrConfiguration"
class="org.directwebremoting.spring.SpringConfigurator">
      <property name="creators">
         <map>
            <entry key="consultaDocSrv">
               <bean class="org.directwebremoting.spring.CreatorConfig">
                  <property name="creator">
                     <bean class="org.directwebremoting.spring.BeanCreator">
                        <property name="bean" ref="consultaDocSrv"/>
                     </bean>
                  </property>
               </bean>
            </entry>          
         </map>
      </property>
      <property name="converters">
        <map>
          <entry key="es.g2k.g2kstore.domain.DocumentoVenta">
            <value>bean</value>
          </entry>
        </map>
      </property>
   </bean>

             

Alex Shneyderman wrote:

> did you see this:
>
> http://bram.jteam.nl/index.php/2006/06/
>
> there is a sample application that has variety of config options one
> of them is
> spring2 and DWR2.
>
>
>
> On 12/16/06, Lexius <lexius.info@...> wrote:
>
>>
>> Does anyone have any working example
>> configs?
>>
>> ...
>> xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
>> http://www.directwebremoting.org/schema/spring-dwr
>> http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd
>> ...
>>
>>
>> <dwr:controller id="dwrController" debug="true" />
>>     <dwr:configuration>
>> .....
>>
>>
>> ?
>> --
>> View this message in context:
>> http://www.nabble.com/DWR-2-and-Spring-2-tf2832281.html#a7907311
>> Sent from the DWR - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> 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@...