Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

DWR and Spring Scoped Beans

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Thanks for reading my post; hopefully I'm in the right forum.

I'm having some intermittent issues getting a session from the WebContext; sometimes it's null. This seems to be related to concurrent users. So, I found this article: http://directwebremoting.org/dwr/documentation/server/integration/spring.html#springCreator and http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-factory-scopes-global-session which explains beans can be scoped. I tried to implement the solution provided on both of these links but this solution is working for me (see below). Am I missing something?

This is what I've done:



springbeans.xml
<bean id="orgDelegate" class="com.example.dwr.OrganizationDelegate" scope="session">
<dwr:remote javascript="OrganizationDelegate">
<dwr:include method="getOrgStreetName"/>
</dwr:remote>
<aop:scoped-proxy proxy-target-class="false" />
</bean>

web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>

Thanks inadvance for your help!
 
Shannon Sims
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, this should read:

I tried to implement the solution provided on both of these links but this solution is NOT working for me (see below).
 
Shannon Sims
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link helped me resolve my issue. Maybe this will help someone else who could also run into this issue: http://forum.springsource.org/archive/index.php/t-26302.html
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic