File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DWR Object binding

 
Daniel Bryant
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I wonder if anyone can help with a conceptual problem I'm having with DWR? Where/how are my server-side objects which DWR calls methods on bound? Are these objects bound to a user http session?

I understand that DWR uses a main servlet that is used to route client-side method calls to appropriate server-side classes and methods, but how are the objects stored (i.e. how are they scoped, session or context etc?), and when are the server-side classes that I have programmed instantiated and when are they eligible for garbage collection?

For anyone that wants any context I am trying to include user authentication in each of my DWR server class constructors, but I need to be sure that each user will have their own instance of the server side class and not share them (because each user will have different privileges). My experiments have so far proved confusing...

Best wishes,

Daniel
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default no, they are not in session scope.

DWR Documentation on creators: includes description of the optional scope attribute.

The scope attribute is largely the same as the scope attribute as defined by the servlet spec. It allows you to specify what a bean is available to. The options are "application", "session", "request" and "page". These values should be familiar to Servlet and JSP developers.

The scope attribute is optional. It defaults to "page".
 
Daniel Bryant
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carol,

Many thanks - now I remember reading this page when I was first learning about DWR, but it completely escaped me!! Now I have set each of my bean creators scope attribute to session in the dwr.xml config file and everything is behaving as expected.

Your pointer to the documentation was great, and very much appreciated.

Best wishes,

Daniel
[ November 19, 2007: Message edited by: Daniel Bryant ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic