Hi all,
I'm writing a web application with Flex / Java(applet) communication through Merapi.
As soon as the flash is launched remotely, the flash player requests the policy file : <policy-file-request/>
You then need to feed the socket with a cross domain xml entry. Example
<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*" to-ports="12345" />
</cross-domain-policy>
Which is exactly what the merapi.PolicyServer class is written for.
(No no you won't find it in the trunk, it's in a branch:
http://code.google.com/p/merapi/source/browse/branches/as3-js-cs-core-devel/java/merapi-core/src/merapi/PolicyServer.java)
Why isn't it in the trunk BTW, as this feature is essential to be able to run merapi with flex.
However:
1. I'm not sure the code is quite stable/finished
2. I'm not sure how to use it.
Obviously you need to start the policy server 1st on port 12345, since Flex will communicate on this port.
But that means you can start the Bridge until he's finished.
Here's my code
PolicyServer ps=new PolicyServer(12345, null);
ps.start();
while(ps.isAlive());
Bridge.open();
new HelloWorldHandler();
I can see the policy file request and the answer.
The problem is that I get other connections on the policy server, so finally I never exit it...