DWR

Spring Creator with springs session scope

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0.2
  • Component/s: Spring
  • Description:
    Hide
    I´m using DWR Version M4d with Spring 2.0 and have a big problems setting the bean scope to session.
    i killed my dwr.xml file and actually configure all dwr Stuff with Spring wich works fine beside the scope problem....

    Here´s my dispatcher-servlet.xml:

    <snip>

    <beans>

    <!-- The mvc frontend configuration -->

    <import resource="spring-mvc-controller.xml"/>

    <!--

    ======================================================================

    -->

    <!-- DWR specific beans -->

    <!--

    ======================================================================

    -->

    <!-- DWR URL Mapping-->

    <bean id="dwrUrlMapping"

    class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">

    <property name="alwaysUseFullPath" value="true" />

    <property name="mappings">

    <props>

    <prop key="/dwr/**/*">dwrController</prop>

    </props>

    </property>

    </bean>

    <!-- DWR Controller -->

    <bean id="dwrController" class="org.directwebremoting.spring.DwrController">

    <property name="configurators">

    <list>

    <ref bean="__dwrConfiguration"/>

    </list>

    </property>

    <property name="debug" value="true"/>

    </bean>

     

    <!-- The DWR Configuration -->

    <bean id="__dwrConfiguration"

    class="org.directwebremoting.spring.SpringConfigurator">

    <property name="creators">

    <map>

    <entry key="minutenverlaufProfilPresenter">

    <bean class="org.directwebremoting.spring.CreatorConfig">

    <property name="creator">

    <bean

    class="org.directwebremoting.spring.BeanCreator">

    <property name="bean"

    ref="minutenverlaufProfilPresenter"/>

    <property name="scope"><value>session</value></property>

    <property

    name="javascript"><value>minutenverlaufProfilPresenter</value></property>

    </bean>

    </property>

    </bean>

    </entry>

    <entry key="tagesreportProfilPresenter">

    <bean class="org.directwebremoting.spring.CreatorConfig">

    <property name="creator">

    <bean

    class="org.directwebremoting.spring.BeanCreator">

    <property name="bean"

    ref="tagesreportProfilPresenter"/>

    </bean>

    </property>

    </bean>

    </entry>

    </map>

    </property>

    <property name="converters">

    <map>

    <entry key="xxx.*">

    <bean class="org.directwebremoting.spring.ConverterConfig">

    <property name="type"><value>bean</value></property>

    </bean>

    </entry>

    </map>

    </property>

    </bean>

    <!-- MinutenprofilPresenter -->

    <bean id="minutenverlaufProfilPresenter"

    class="xxx.web.MinutenverlaufProfilPresenter">

    <property name="businessDelegate"><ref
    bean="businessDelegate"></ref></property>

    </bean>

    <!-- TagesreportprofilPresenter -->

    <bean id="tagesreportProfilPresenter"

    class="xxx.web.TagesreportProfilPresenter">

    <property name="businessDelegate"><ref
    bean="businessDelegate"></ref></property>

    </bean>

    <!-- MinutenverlaufBusinessDelegate -->

    <bean id="businessDelegate"

    class="xxx.toanotherpackage.Ebs2BusinessDelegateImpl"/>

    </beans>

    </snap>

    The Session scope for the bean minutenverlaufProfilPresenter is succesfully
    set to session as i could see in debug a session. But the scope has no
    effect because Spring instantiates it as Singleton. If i call the page from
    two different browser only one object instance is serving the requests and
    the changes from one user effect the other users.

    When i try to set the scope for the spring bean definitions to session i get
    a java.lang.IllegalStateException.

    And i do have a WebApplicationContext, so DWR should know the configuration
    and using springs session scope should work (and it does in a configuration
    without dwr).

    I think that´s because Spring gets confused when only some beans in the
    object tree have session scope. But setting all beans to session scope also
    doesn´t work.

    I really like the possibility to configure dwr via springs configuration
    file and i would like to keep this.

    So, how can i set a dwr bean to session scope using only the spring
    configuration ???

    Thanks in advance,

    fab
    Show
    I´m using DWR Version M4d with Spring 2.0 and have a big problems setting the bean scope to session. i killed my dwr.xml file and actually configure all dwr Stuff with Spring wich works fine beside the scope problem.... Here´s my dispatcher-servlet.xml: <snip> <beans> <!-- The mvc frontend configuration --> <import resource="spring-mvc-controller.xml"/> <!-- ====================================================================== --> <!-- DWR specific beans --> <!-- ====================================================================== --> <!-- DWR URL Mapping--> <bean id="dwrUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="alwaysUseFullPath" value="true" /> <property name="mappings"> <props> <prop key="/dwr/**/*">dwrController</prop> </props> </property> </bean> <!-- DWR Controller --> <bean id="dwrController" class="org.directwebremoting.spring.DwrController"> <property name="configurators"> <list> <ref bean="__dwrConfiguration"/> </list> </property> <property name="debug" value="true"/> </bean>   <!-- The DWR Configuration --> <bean id="__dwrConfiguration" class="org.directwebremoting.spring.SpringConfigurator"> <property name="creators"> <map> <entry key="minutenverlaufProfilPresenter"> <bean class="org.directwebremoting.spring.CreatorConfig"> <property name="creator"> <bean class="org.directwebremoting.spring.BeanCreator"> <property name="bean" ref="minutenverlaufProfilPresenter"/> <property name="scope"><value>session</value></property> <property name="javascript"><value>minutenverlaufProfilPresenter</value></property> </bean> </property> </bean> </entry> <entry key="tagesreportProfilPresenter"> <bean class="org.directwebremoting.spring.CreatorConfig"> <property name="creator"> <bean class="org.directwebremoting.spring.BeanCreator"> <property name="bean" ref="tagesreportProfilPresenter"/> </bean> </property> </bean> </entry> </map> </property> <property name="converters"> <map> <entry key="xxx.*"> <bean class="org.directwebremoting.spring.ConverterConfig"> <property name="type"><value>bean</value></property> </bean> </entry> </map> </property> </bean> <!-- MinutenprofilPresenter --> <bean id="minutenverlaufProfilPresenter" class="xxx.web.MinutenverlaufProfilPresenter"> <property name="businessDelegate"><ref bean="businessDelegate"></ref></property> </bean> <!-- TagesreportprofilPresenter --> <bean id="tagesreportProfilPresenter" class="xxx.web.TagesreportProfilPresenter"> <property name="businessDelegate"><ref bean="businessDelegate"></ref></property> </bean> <!-- MinutenverlaufBusinessDelegate --> <bean id="businessDelegate" class="xxx.toanotherpackage.Ebs2BusinessDelegateImpl"/> </beans> </snap> The Session scope for the bean minutenverlaufProfilPresenter is succesfully set to session as i could see in debug a session. But the scope has no effect because Spring instantiates it as Singleton. If i call the page from two different browser only one object instance is serving the requests and the changes from one user effect the other users. When i try to set the scope for the spring bean definitions to session i get a java.lang.IllegalStateException. And i do have a WebApplicationContext, so DWR should know the configuration and using springs session scope should work (and it does in a configuration without dwr). I think that´s because Spring gets confused when only some beans in the object tree have session scope. But setting all beans to session scope also doesn´t work. I really like the possibility to configure dwr via springs configuration file and i would like to keep this. So, how can i set a dwr bean to session scope using only the spring configuration ??? Thanks in advance, fab

Activity

Hide
Jose Noheda added a comment - 08/Feb/08 8:19 AM

Added documentation about how to configure scoped beans to the web

Show
Jose Noheda added a comment - 08/Feb/08 8:19 AM Added documentation about how to configure scoped beans to the web

People

Dates

  • Created:
    12/Apr/07 12:35 PM
    Updated:
    29/Feb/08 10:29 AM
    Resolved:
    08/Feb/08 8:19 AM