This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Flex + Java + BlazeDS: Some instances already created on the server are unavailable from Flex

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone.
Thank you for all the documentation, and the great forum.

I have a question about the Java Factory; I've read somewhere that: "... the JavaFactory will check if there is already an instance in the scope and return that. If the object is not available then it is instantiated ...", but I don't understand the expression "if the object is not available"?

I am having trouble to find and/or assign classes already instantiated (by another class) in the server, to a declared destination.

Here is the scenario:
I'm developing an application in Java:
  • J2EE.
  • I'm running it on a Tomcat 6 server
  • I'm using BlazeDS to communicate with Flex.
  • I'm using the RPC's Remoting Service (through RemoteObjects)


  • There are two java classes that handle Client (Flex) interaction, say ApplicationClass and UserApplicationClass:

  • ApplicationClass has a reference (attribute) to a UserApplicationClass instance
  • ApplicationClass should be the one and only entry point (although BlazeDS requires an empty constructor) to instantiate a UserApplicationClass;
  • UserApplicationClass is instantiated, right after the attribute User has been set on ApplicationClass.


  • //Java Code


    Up to here everything is fine:
    From the Flex client I am able to use ApplicationClass methods, set its User and get the UserApplicationClass attribute from ApplicationClass.

    But here is the problem:
    When I try to use any method of UserApplicationClass, It doesn't find the class already created on the server, but instead, it instantiates a brand new one (with all of its attributes set to null by using the default constructor).

    How could I assure that the destination points to a specified instance on the server, created by another class, and not instantiating a new one?

    // Flex Client Code


    Note: scope attribute (on remoting-config.xml) on both destinations is set to session.

    I hope I have been clear; I would really appreciate if you could help me.

    Thanks in advance,

    AM
     
    Men call me Jim. Women look past me to this tiny ad:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!