6 Replies Latest reply on Jul 10, 2008 8:40 AM by Joerg Schneider

    Component name aliasing not working with Seam remoting

    Joerg Schneider Newbie


      using Seam remoting, we found that java package styled naming conventions can't be used due to the '.' / dot character that messes up the javascript engine at the client side.

      We therefore tired to alias a fully qualified Seam component name using the 'factory' tag in components.xml as per the Seam documentation.

      Anyhow, using Seam remoting, Seam is not able to find that component via it's alias, but only if using a full qualified name.

      Any idea what goes wrong here ? Did anyone make the same experience ?

      Any help appreciated :-)

      Cheers, Joerg

        • 1. Re: Component name aliasing not working with Seam remoting
          Dan Allen Master

          At this time, Seam remoting requires use of the @Name annotation only for exporting a component (it has no knowledge of component definitions in components.xml).

          I don't understand your problem with the names.

          var manager = Seam.Component.getInstance("org.jboss.seam.core.manager");

          • 2. Re: Component name aliasing not working with Seam remoting
            Joerg Schneider Newbie


            the problem occurs, if not using a javascript variable, something like :


            instead of

                 var manager = Seam.Component.getInstance(org.jboss.seam.core.manager);

            Can you confirm ? If so, that should be documented in the Reference Guide, since the way it is mostly described in the doc's is by not using a javascript variable and that will be a common pitfall.

            Cheers, Joerg

            • 3. Re: Component name aliasing not working with Seam remoting
              System Administrator Expert

              this is the example from the Seam 2.0.1.GA ref pdf that I used successfully as a model for my Seam remoting cases:

              <script type="text/javascript">
              function sayHello() {
              var name = prompt("What is your name?");
              Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback);
              function sayHelloCallback(result) {
              // ]]>

              I don't think I've ever experienced the problem you're talking about.

              The way it works is you replace helloAction above with the @Name(foobar) value (in this case foobar) of your component.  Why do you need to prepend any package name?

              What is it exactly that you're trying to achieve in your Seam remoting call?

              • 5. Re: Component name aliasing not working with Seam remoting
                Joerg Schneider Newbie

                Hi Arbi,

                your code snippet works fine, since it is not referring to a java style package named Seam component, but a simple helloAction component. What if the name of the component is much more complex, something like com.db.tss.core.action.HelloAction ? I'd assume if you replace helloAction with such a fully qualified component name it doesn't work anymore and that is exactly the problem I have.

                As per Seam documentation it is recommended to use java style fully qualified package naming for your Seam components - and that makes perfect sense for me, not only if you plan to develop large and complex applications. Anyhow, this fully qualified name can not be used with Seam remoting if not dereferencing the Seam component name into a javascript variable - that's my point here - and this is not documented in the Seam reference. Assigning a short name / alias to a Seam component via the factory tag in components.xml (as per Seam documentation) to overcome this issue doesn't work.

                Again :

                Seam.Component.getInstance("helloAction").sayHello(name, sayHelloCallback) - will work.

                Seam.Component.getInstance("com.db.tss.core.action.HelloAction").sayHello(name, sayHelloCallback) - will not work.

                var hello = Seam.Component.getInstance("com.db.tss.core.action.HelloAction");
                hello.sayHello(name, sayHelloCallback) - will work again.

                Could you confirm ?

                Cheers, Joerg.

                • 6. Re: Component name aliasing not working with Seam remoting
                  Joerg Schneider Newbie


                  does that mean your proposed workaround to use a javascript variable also doesn't work :

                  var manager = Seam.Component.getInstance("org.jboss.seam.core.manager");


                  Currently we are using underscores for the SLSB bean's that act as a wrapper/facade for remoting purposes. The real components behind this beans still use the java style package names - that's working fine, even though the underscores look ugly in our code.

                  Since you've created a JIRA bug entry, I assume this behaviour will be corrected in a later version. If someone spents some efforts on this, would it be to much to ask for if a alias name (via the <factory> tag in components.xml) could also be supported by Seam remoting ? That would beautify our javascript a bit :-)

                  Thanks for your help.

                  Cheers, Joerg.