2 Replies Latest reply on Oct 21, 2003 12:26 PM by semi

    Local or Remote invoked?

    semi Newbie

      Hi,

      is it somehow possible to know within a session bean method whether it's invoked over the local or remote interface?
      Depending on that I would like to return different results in a Collection.
      SessionContext does not cover this Information.

      Thanks,
      Michael

        • 1. Re: Local or Remote invoked?
          Manav Newbie

          If invoking getEJBLocalObject() method of SessionContext returns null or an exception then it should be a remote call.

          I would have thought that should work.

          Regards
          Manav

          • 2. Re: Local or Remote invoked?
            semi Newbie

            Hi,

            Thanks, but it seems not to work this way.

            I tried the following Code.
            The output is: "LocalObject not null: true"
            when called from outside the container (client app) (RemoteHome and Interface)[pre]
            public void sayHello()
            {
            try
            {
            System.out.println(
            "LocalObject not null: "
            + (sessionContext.getEJBLocalObject()!=null)
            );
            }
            catch(IllegalStateException e)
            {
            e.printStackTrace();
            }
            }
            [/pre]Any other idea?

            Best Regards,
            Michael