Hi Carlos,

FlexJS outputs JS so you should be able to integrate with any other JS
code you find out there.  The main issue, IMO, is whether that code is
written in an object-oriented manner.  The more it is, the easier it is to
work with from FlexJS.  You can thinly wrap an ActionScript class
definition around the methods and "it should just work".  However, it is
tempting for existing libraries to not be so object-oriented because of
speed and size and the lack of structure of JS.  JS is like clay.  AS is
like a construction kit.  If something doesn't quite fit in JS, you can
force it.  In AS, the structure definitely tells you that it isn't
supposed to go together that way.  So, you should be able to try
Atmosphere if you want and try to wrap it in AS.

However, the CORS issue ran into should apply in all cases, whether you
use Atmosphere, AMFJS with hand-coded JS or AMFJS in FlexJS. I think as
long as you are going cross-domain you have to "do the right thing" to
give permission.  I'm not an expert on CORS at all, but I think you have
to have a server that serves CORS headers, sort of like crossdomain.xml.
It may not work from file://.  You may get different results from http://
than file://

If you can set up a test case where the domain is the same as the domain
that serves the HTML/JS/CSS you shouldn't have a CORS issue and then we'd
know whether it works for same-domain configurations.

HTH,
-Alex

On 10/24/16, 9:58 PM, "Carlos Cruz" <[email protected]> wrote:

>This is my experience trying to connect to BlazeDS with AMFJS:
>
>I tried connecting AMFJS to BlazeDS , ping only, it worked with Internet
>Explorer 11 and with MS Edge using url:
>http://localhost/ccradius_2/amfjstest.html. With Firefox, Opera and
>Chrome I
>get: CORS header 'Access-Control-Allow-Origin' missing with either url.
>
>If it helps anyone:
>Html server ulr =  http://test.ccradius_2.com/amfjstest.html
>Also tried Html server ulr = http://localhost/ccradius_2/amfjstest.html
>Tomcat/BlazeDS server url =
>http://localhost:8080/ccurbiz/messagebroker/amf
>
>I did try to add a domain exception in the Apache httpd server in the
>VirtualHosts with: (I tried a bunch of stuff this is the latest)
>    
>    ErrorLog "logs/error-debug.log"
>    # CustomLog "logs/error-custom.log"
>    
>    Header set Access-Control-Allow-Origin "*"
>    
>    Header set X-Frame-Options: "sameorigin"
>    Header set X-XSS-Protection: "1; mode=block"
>
>    Header always set Content-Security-Policy "default-src 'self'
>http://localhost:8080; script-src 'self' 'unsafe-inline' 'unsafe-eval'
>http://localhost:8080 'self' http://localhost:8080; object-src 'self' ;
>block-all-mixed-content; plugin-types application/pdf;"
>
>
>As for the AS script I'm just using AMFJS's example code:
><script type="text/javascript">
>               document.getElementById("lableid").value = "change in text
>or whatever 200";
>               
>        var amfClient = new amf.Client("flex",
>"http://localhost:8080/ccurbiz/messagebroker/amf";);
>        var p = amfClient.invoke("com.ccradius.test.Test ", "ping", []);
>
>        p.then(
>            function(res) {
>                               document.getElementById("lableid2").value =
>"SUCCESS";
>                console.log(res.data);
>            },
>            function(err) {
>                               document.getElementById("lableid2").value =
>"ERROR";
>                console.log("ping errror");
>            }
>        );
>               
>    </script>
>
>Unless I find a work around, I'm going to try to Atmosphere
>(https://github.com/Atmosphere/atmosphere) , but I have a question similar
>to the previous post would I be able to use atmosphere with FlexJS code
>and
>compile?
>
>Thx!
>Carlos
>
>-----Original Message-----
>From: PKumar [mailto:[email protected]]
>Sent: Wednesday, October 19, 2016 5:14 AM
>To: [email protected]
>Subject: Re: [FlexJS] Support in BlazeDS communication
>
>Hi Alex,
>
>I tried to connect with webORB.net using AMFJS and it is working.  I will
>check it with BlazeDS also. I am having one query here, can I compile
>AMFJS
>to  FlexJS library, as currently FlexJS havig JQuery support?
>
>
>
>-----
>Regards,
>Prashant
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Support-in-BlazeDS-c
>om
>munication-tp11562p13855.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply via email to