I have a Java REST webservice deployed on tomcat (http://localhost:8080/myrestfulapp/aservice/).
In my qooxdoo app, I try to send a POST request using qx.io.remote.Request. I built the application and deployed it on an apache HTTP server (named http://myserver.org). When I try to send the request, I get this error in javascript console of my web browser (Chrome on linux): Origin http//myserver.org is not allowed by Access-Control-Allow-Origin
I added crossdomain.xml in tomcat's ROOT webapp, in /var/www and in my http server's root directory. I enabled apache headers (a2enmod headers) and I added Access-Control-Allow-Origin "*" in my server's configuration file.
here is my qooxdoo function sending the request:
envoyer : function(id, nom, prenom, poste)
{
var url = "http://localhost:8080/helloworld/enregistrer";
var donnees = "{ \"id\":" + id + ", \"nom\":\"" + nom + "\", \"prenom\":\"" + prenom + "\", \"poste\":\""+poste +"\" }";
alert(donnees);
var req = new qx.io.remote.Request(url, "POST", "application/json");
req.setData(donnees);
req.addListener("completed", function(e) {
alert(e.getContent());
});
req.send();
}
and here is the myserver.org configuration file: ServerAdmin webmaster@localhost serverName myserver.org
DocumentRoot /home/jihedamine/HttpServer
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/jihedamine/HttpServer/>
Header set Access-Control-Allow-Origin "*"
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
So how could I enable sending cross origin http requests from a qooxdoo app to a java backend deployed on tomcat ?