6 Replies Latest reply on Feb 22, 2008 2:48 AM by Samuel Doyle

    Seam and PHP ??

    Samuel Doyle Apprentice

      So I'm looking at project which was historically PHP driven and now making a migration to Java. I'm new to the project so not exactly sure why this decision has been made but it is and is going forward.


      As part of the migration there is a a lot of Java logic on the backend that is being invoked via AJAX requests on the front end served up with PHP.


      Just out of curiosity I was wondering how easy it would be to say make use of Seam Remoting in the same way? Since Seam is based off JSF I'm not really sure if how this could be done in  terms of making it work from within PHP generated pages and if so I suspect it would be a large hack.

        • 1. Re: Seam and PHP ??
          James Kelly Newbie

          I don't see why not. The Seam Remoting stuff is all Javascript on the client-side; you're not rendering any JSF views to call remoted server methods.


          You may be thinking of Ajax4JSF which is tied to using JSF.



          • 2. Re: Seam and PHP ??
            Joshua Jackson Master

            Wow cool. I never thought of PHP connecting to Seam via Seam remoting. I think I'm gonna learn about this Seam remoting.


            Thanks

            • 3. Re: Seam and PHP ??
              Samuel Doyle Apprentice

              James Kelly wrote on Feb 21, 2008 01:01 AM:


              I don't see why not. The Seam Remoting stuff is all Javascript on the client-side; you're not rendering any JSF views to call remoted server methods.

              You may be thinking of Ajax4JSF which is tied to using JSF.





              So basically you doing what DWR does but gaining the ability to invoke Seam components on the backend. I thought however to make use of Seam Remoting there was required metadata that is populated in the requests. I remember looking at some of the requests before and it contained a substantial amount of metadata. I'm not sure if this will just work like this.


              Can someone from the Seam team clarify?

              • 4. Re: Seam and PHP ??
                Samuel Doyle Apprentice

                Can someone confirm if just the JavaScript based Remoting capability can work on its own in a similar fashion DWR does?

                • 5. Re: Seam and PHP ??
                  James Kelly Newbie

                  Yah, it's very DWR-ish. Assuming you've set up your Seam environment correctly to support remoting, the only thing you're sourcing on the client-side is remoting framework and your component stubs, e.g.


                  <script type="text/javascript" src="seam/resource/remoting/resource/remote.js"></script>
                  



                  ...and...


                  <script type="text/javascript"
                  src="seam/resource/remoting/interface.js?customerAction"></script>
                  



                  Now, Seam has a JSF tag to simplify sourcing the component stubs, but you don't need to use it.


                  Take a look at the examples/remoting/hellowold application. You can actually install that and then call the remote methods from a PHP script, static HTML, whatever. The only hurdle will be to get around the cross site scripting issues. You can set up a proxy redirect in apache with a .htaccess like...


                  RewriteEngine on
                  RewriteRule ^seam-helloworld/seam/resource(.*)$ http://YOURJBOSSHOST/seam-helloworld/seam/resource$1 [P]
                  



                  With the proxy directive, I could copy the static HTML from the HelloWorld exmaple to my htdocs directory and it worked fine.

                  • 6. Re: Seam and PHP ??
                    Samuel Doyle Apprentice

                    Cool and thanks!


                    S.D.